linux/fs/btrfs
Nikolay Borisov c2d1b3aae3 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: 499f377f49 ("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>
2019-04-29 19:02:35 +02:00
..
tests btrfs: inode: Verify inode mode to avoid NULL pointer dereference 2019-04-29 19:02:32 +02:00
acl.c Btrfs: setup a nofs context for memory allocation at __btrfs_set_acl 2019-02-25 14:13:17 +01:00
async-thread.c btrfs: simplify workqueue name when allocating 2019-02-25 14:13:24 +01:00
async-thread.h
backref.c btrfs: use BUG() instead of BUG_ON(1) 2019-04-29 19:02:28 +02:00
backref.h
btrfs_inode.h btrfs: use common file type conversion 2019-04-29 19:02:29 +02:00
check-integrity.c btrfs: Fix typos in comments and strings 2018-12-17 14:51:50 +01:00
check-integrity.h
compression.c btrfs: Use less confusing condition for uptodate parameter to btrfs_writepage_endio_finish_ordered 2019-04-29 19:02:24 +02:00
compression.h btrfs: change set_level() to bound the level passed in 2019-02-25 14:13:32 +01:00
ctree.c btrfs: get fs_info from eb in btrfs_verify_level_key 2019-04-29 19:02:31 +02:00
ctree.h btrfs: tree-checker: Verify inode item 2019-04-29 19:02:32 +02:00
dedupe.h
delayed-inode.c btrfs: get fs_info from eb in btrfs_leaf_free_space 2019-04-29 19:02:30 +02:00
delayed-inode.h
delayed-ref.c btrfs: qgroup: Move reserved data accounting from btrfs_delayed_ref_head to btrfs_qgroup_extent_record 2019-02-25 14:13:39 +01:00
delayed-ref.h btrfs: qgroup: Move reserved data accounting from btrfs_delayed_ref_head to btrfs_qgroup_extent_record 2019-02-25 14:13:39 +01:00
dev-replace.c btrfs: drop the lock on error in btrfs_dev_replace_cancel 2019-02-25 14:13:41 +01:00
dev-replace.h btrfs: dev-replace: open code trivial locking helpers 2018-12-17 14:51:45 +01:00
dir-item.c
disk-io.c btrfs: qgroup: remove obsolete fs_info members 2019-04-29 19:02:31 +02:00
disk-io.h btrfs: get fs_info from eb in btrfs_verify_level_key 2019-04-29 19:02:31 +02:00
export.c
export.h
extent_io.c btrfs: get fs_info from eb in leaf_data_end 2019-04-29 19:02:30 +02:00
extent_io.h btrfs: get fs_info from eb in repair_eb_io_failure 2019-04-29 19:02:29 +02:00
extent_map.c btrfs: Remove impossible condition from mergable_maps 2019-02-25 14:13:21 +01:00
extent_map.h btrfs: Remove impossible condition from mergable_maps 2019-02-25 14:13:21 +01:00
extent-tree.c btrfs: Honour FITRIM range constraints during free space trim 2019-04-29 19:02:35 +02:00
file-item.c btrfs: get fs_info from eb in btrfs_leaf_free_space 2019-04-29 19:02:30 +02:00
file.c btrfs: get fs_info from eb in btrfs_leaf_free_space 2019-04-29 19:02:30 +02:00
free-space-cache.c
free-space-cache.h
free-space-tree.c btrfs: get fs_info from eb in clean_tree_block 2019-04-29 19:02:30 +02:00
free-space-tree.h
inode-item.c
inode-map.c
inode-map.h
inode.c btrfs: inode: Verify inode mode to avoid NULL pointer dereference 2019-04-29 19:02:32 +02:00
ioctl.c btrfs: Perform locking/unlocking in btrfs_remap_file_range() 2019-04-29 19:02:29 +02:00
Kconfig
locking.c btrfs: switch extent_buffer::lock_nested to bool 2019-04-29 19:02:21 +02:00
locking.h btrfs: merge btrfs_set_lock_blocking_rw with it's caller 2019-02-25 14:13:28 +01:00
lzo.c btrfs: change set_level() to bound the level passed in 2019-02-25 14:13:32 +01:00
Makefile
math.h
ordered-data.c btrfs: Switch memory allocations in async csum calculation path to kvmalloc 2019-04-25 14:17:38 +02:00
ordered-data.h btrfs: switch BTRFS_ORDERED_* to enums 2018-12-17 14:51:43 +01:00
orphan.c
print-tree.c btrfs: get fs_info from eb in btrfs_leaf_free_space 2019-04-29 19:02:30 +02:00
print-tree.h
props.c btrfs: prop: open code btrfs_set_prop in inherit_prop 2019-04-29 19:02:35 +02:00
props.h btrfs: refactor btrfs_set_prop and add btrfs_set_prop_trans 2019-04-29 19:02:19 +02:00
qgroup.c btrfs: get fs_info from eb in clean_tree_block 2019-04-29 19:02:30 +02:00
qgroup.h btrfs: qgroup: Move reserved data accounting from btrfs_delayed_ref_head to btrfs_qgroup_extent_record 2019-02-25 14:13:39 +01:00
raid56.c for-5.1-rc2-tag 2019-03-26 10:32:13 -07:00
raid56.h
rcu-string.h
reada.c btrfs: dev-replace: open code trivial locking helpers 2018-12-17 14:51:45 +01:00
ref-verify.c btrfs: replace btrfs_set_lock_blocking_rw with appropriate helpers 2019-02-25 14:13:27 +01:00
ref-verify.h
relocation.c btrfs: fix panic during relocation after ENOSPC before writeback happens 2019-04-29 19:02:24 +02:00
root-tree.c btrfs: Don't panic when we can't find a root key 2019-04-29 19:02:17 +02:00
scrub.c btrfs: scrub: return EAGAIN when fs is closing 2019-04-29 19:02:17 +02:00
send.c Btrfs: send, improve clone range 2019-04-29 19:02:35 +02:00
send.h
struct-funcs.c
super.c btrfs: drop unused parameter in mount_subvol 2019-04-29 19:02:35 +02:00
sysfs.c btrfs: Add sysfs support for metadata_uuid feature 2018-12-17 14:51:37 +01:00
sysfs.h btrfs: drop extra enum initialization where using defaults 2018-12-17 14:51:43 +01:00
transaction.c btrfs: Introduce extent_io_tree::owner to distinguish different io_trees 2019-04-29 19:02:18 +02:00
transaction.h Btrfs: remove no longer used 'sync' member from transaction handle 2019-04-29 19:02:18 +02:00
tree-checker.c btrfs: tree-checker: get fs_info from eb in check_inode_item 2019-04-29 19:02:35 +02:00
tree-checker.h btrfs: Move btrfs_check_chunk_valid() to tree-check.[ch] and export it 2019-04-29 19:02:31 +02:00
tree-defrag.c btrfs: open code now trivial btrfs_set_lock_blocking 2019-02-25 14:13:27 +01:00
tree-log.c btrfs: get fs_info from eb in clean_tree_block 2019-04-29 19:02:30 +02:00
tree-log.h
ulist.c
ulist.h
uuid-tree.c btrfs: Turn an 'else if' into an 'else' in btrfs_uuid_tree_add 2019-04-29 19:02:19 +02:00
volumes.c btrfs: tree-checker: Verify dev item 2019-04-29 19:02:32 +02:00
volumes.h btrfs: tree-checker: Verify dev item 2019-04-29 19:02:32 +02:00
xattr.c btrfs: get fs_info from eb in btrfs_leaf_free_space 2019-04-29 19:02:30 +02:00
xattr.h
zlib.c btrfs: change set_level() to bound the level passed in 2019-02-25 14:13:32 +01:00
zstd.c btrfs: zstd: remove indirect calls for local functions 2019-04-29 19:02:18 +02:00