summaryrefslogtreecommitdiffstats
path: root/Documentation/locking
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2022-05-31 16:06:37 +0100
committerDavid Sterba <dsterba@suse.com>2022-07-25 17:44:35 +0200
commit36baa2c75121651710d68ab7fc3abc072fb408bd (patch)
tree7c7133c0dd84caee5b031dd425a45f7ab44ee655 /Documentation/locking
parent2b1d260de14064606601f2e125cb8627ffeecd7e (diff)
downloadlinux-stable-36baa2c75121651710d68ab7fc3abc072fb408bd.tar.gz
linux-stable-36baa2c75121651710d68ab7fc3abc072fb408bd.tar.bz2
linux-stable-36baa2c75121651710d68ab7fc3abc072fb408bd.zip
btrfs: refactor the delayed item deletion entry point
The delayed item deletion entry point, btrfs_delete_delayed_items(), is a bit convoluted for a few reasons: 1) It's really a loop disguised with labels and goto statements; 2) There's a 'delete_fail' label which isn't only for error cases, we can jump to that label even if no error happened, if we simply don't have more delayed items to delete; 3) Unnecessarily keeps track of the current and previous items for no good reason, as after getting the next item and releasing the current one, it just jumps to the 'again' label just to look again for the first delayed item; 4) When a delayed item is not in the tree (because it was already deleted before), it releases the item while holding a path locked, which is not necessary and adds more contention to the tree, specially taking into account that the path came from a deletion search, meaning we have write locks for nodes at levels 2, 1 and 0. And releasing the item is not computationally trivial (rb tree deletion, a kfree() and some trivial things). So refactor it to use a while loop and add some comments to make it more obvious why we can have delayed items without a matching item in the tree as well as why not keep the delayed node locked all the time when running all its deletion items. This is also a preparation for some upcoming work involving delayed items. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'Documentation/locking')
0 files changed, 0 insertions, 0 deletions