diff options
author | Nikolay Borisov <nborisov@suse.com> | 2018-08-15 17:26:52 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-12-17 14:51:30 +0100 |
commit | 5c623d334a4f7f270de223cde2a3f3b743023e2a (patch) | |
tree | 6392b12ed09d4bb8a11955cb270cae551d7cec3c /fs/btrfs/backref.c | |
parent | btrfs: Remove needless tree locking in iterate_inode_refs (diff) | |
download | linux-5c623d334a4f7f270de223cde2a3f3b743023e2a.tar.xz linux-5c623d334a4f7f270de223cde2a3f3b743023e2a.zip |
btrfs: Remove needless tree locking in iterate_inode_extrefs
In iterate_inode_exrefs the eb is cloned via btrfs_clone_extent_buffer
which creates a private extent buffer with the dummy flag set and ref
count of 1. Then this buffer is locked for reading and its ref count is
incremented by 1. Finally it's fed to the passed iterate_irefs_t
function. The actual iterate call back is inode_to_path (coming from
paths_from_inode) which feeds the eb to btrfs_ref_to_path. In this final
function the passed eb is only read by first assigning it to the local
eb variable. This variable is only modified in the case another eb was
referenced from the passed path that is eb != eb_in check triggers.
Considering this there is no point in locking the cloned eb in
iterate_inode_refs since it's never being modified and is not published
anywhere. Furthermore the cloned eb is completely fine having its ref
count be 1.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/backref.c')
-rw-r--r-- | fs/btrfs/backref.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 65f327b34cfb..4a15f87dbbb4 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c @@ -2079,10 +2079,6 @@ static int iterate_inode_extrefs(u64 inum, struct btrfs_root *fs_root, ret = -ENOMEM; break; } - extent_buffer_get(eb); - - btrfs_tree_read_lock(eb); - btrfs_set_lock_blocking_rw(eb, BTRFS_READ_LOCK); btrfs_release_path(path); item_size = btrfs_item_size_nr(eb, slot); @@ -2103,7 +2099,6 @@ static int iterate_inode_extrefs(u64 inum, struct btrfs_root *fs_root, cur_offset += btrfs_inode_extref_name_len(eb, extref); cur_offset += sizeof(*extref); } - btrfs_tree_read_unlock_blocking(eb); free_extent_buffer(eb); offset++; |