Commit c2d1b3a
btrfs: Honour FITRIM range constraints during free space trim
Up until now trimming the freespace was done irrespective of what the
arguments of the FITRIM ioctl were. For example fstrim's -o/-l arguments
will be entirely ignored. Fix it by correctly handling those paramter.
This requires breaking if the found freespace extent is after the end of
the passed range as well as completing trim after trimming
fstrim_range::len bytes.
Fixes: 499f377 ("btrfs: iterate over unused chunk space in FITRIM")
CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>1 parent 040ee61 commit c2d1b3a
1 file changed
+19
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11309 | 11309 | | |
11310 | 11310 | | |
11311 | 11311 | | |
11312 | | - | |
| 11312 | + | |
11313 | 11313 | | |
11314 | | - | |
| 11314 | + | |
11315 | 11315 | | |
11316 | 11316 | | |
11317 | 11317 | | |
| |||
11354 | 11354 | | |
11355 | 11355 | | |
11356 | 11356 | | |
11357 | | - | |
11358 | | - | |
| 11357 | + | |
| 11358 | + | |
11359 | 11359 | | |
11360 | 11360 | | |
11361 | 11361 | | |
| |||
11368 | 11368 | | |
11369 | 11369 | | |
11370 | 11370 | | |
| 11371 | + | |
| 11372 | + | |
| 11373 | + | |
| 11374 | + | |
| 11375 | + | |
| 11376 | + | |
| 11377 | + | |
| 11378 | + | |
| 11379 | + | |
| 11380 | + | |
11371 | 11381 | | |
11372 | 11382 | | |
11373 | 11383 | | |
| |||
11377 | 11387 | | |
11378 | 11388 | | |
11379 | 11389 | | |
| 11390 | + | |
| 11391 | + | |
| 11392 | + | |
| 11393 | + | |
11380 | 11394 | | |
11381 | 11395 | | |
11382 | 11396 | | |
| |||
11460 | 11474 | | |
11461 | 11475 | | |
11462 | 11476 | | |
11463 | | - | |
11464 | | - | |
| 11477 | + | |
11465 | 11478 | | |
11466 | 11479 | | |
11467 | 11480 | | |
| |||
0 commit comments