]> git.ipfire.org Git - thirdparty/linux.git/commit
btrfs: reduce extent tree lock contention when searching for inline backref
authorRobbie Ko <robbieko@synology.com>
Thu, 24 Oct 2024 02:31:42 +0000 (10:31 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 11 Nov 2024 13:34:19 +0000 (14:34 +0100)
commit1d16c2761bcc412ae4d9fb9fd9934cd426814191
tree2b29dc4e6c97e079087e76f8cad190704d14ac61
parent6e6ecdec22645db64d14c25915444f238d98da0d
btrfs: reduce extent tree lock contention when searching for inline backref

When inserting extent backref, in order to check whether refs other than
inline refs are used, we always use path keep locks for tree search, which
will increase the lock contention of extent tree.

We do not need the parent node every time to determine whether normal
refs are used.  It is only needed when the extent item is the last item
in a leaf.

Therefore, we change it to first use keep_locks=0 for search.  If the
extent item happens to be the last item in the leaf, we then change to
keep_locks=1 for the second search to reduce lock contention.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Robbie Ko <robbieko@synology.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c