btrfs: add correction to handle -1 edge case in async discard

From Dave's testing, it's possible to drive a file system to have -1
discardable_extents and a corresponding negative discardable_bytes. As
btrfs_discard_calc_delay() is the only user of discardable_extents, we
can correct here for any negative discardable_extents/discardable_bytes.

Reported-by: David Sterba <>
Signed-off-by: Dennis Zhou <>
1 file changed