summaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2015-06-15 09:41:17 -0400
committerChris Mason <clm@fb.com>2015-07-29 08:15:26 -0700
commit499f377f49f085ee4aa214c738e948e88626f39b (patch)
tree1c9485ec464fd6619b7ca91425de51dad29cc421 /fs/cifs
parent86557861dfe4f8defde0df40620b97cc60285aa4 (diff)
downloadop-kernel-dev-499f377f49f085ee4aa214c738e948e88626f39b.zip
op-kernel-dev-499f377f49f085ee4aa214c738e948e88626f39b.tar.gz
btrfs: iterate over unused chunk space in FITRIM
Since we now clean up block groups automatically as they become empty, iterating over block groups is no longer sufficient to discard unused space. This patch iterates over the unused chunk space and discards any regions that are unallocated, regardless of whether they were ever used. This is a change for btrfs but is consistent with other file systems. We do this in a transactionless manner since the discard process can take a substantial amount of time and a transaction would need to be started before the acquisition of the device list lock. That would mean a transaction would be held open across /all/ of the discards collectively. In order to prevent other threads from allocating or freeing chunks, we hold the chunks lock across the search and discard calls. We release it between searches to allow the file system to perform more-or-less normally. Since the running transaction can commit and disappear while we're using the transaction pointer, we take a reference to it and release it after the search. This is safe since it would happen normally at the end of the transaction commit after any locks are released anyway. We also take the commit_root_sem to protect against a transaction starting and committing while we're running. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Tested-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/cifs')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud