diff options
author | Nikolay Borisov <nborisov@suse.com> | 2019-05-23 07:51:26 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-09-09 08:59:02 -0400 |
commit | e678934cbe5f026c2765a1da651e61daa5724fb3 (patch) | |
tree | e1070146d58367624b9ec65eb0ced82515958de5 /fs/btrfs/tree-log.c | |
parent | 32e534402ad52e9f35c32be68e25213db722892b (diff) |
btrfs: Remove unnecessary check from join_running_log_trans
join_running_log_trans checks btrfs_root::log_root outside of
btrfs_root::log_mutex to avoid contention on the mutex. Turns out this
check is not necessary because the two callers of join_running_log_trans
(both of which deal with removing entries from the tree-log during
unlink) explicitly check whether the respective inode has been logged in
the current transaction.
If it hasn't then it won't have any items in the tree-log and call path
will return before calling join_running_log_trans. If the check passes,
however, then it's guaranteed that btrfs_root::log_root is set because
the inode is logged.
Those guarantees allows us to remove the speculative as well as the
implicity and tricky memory barrier.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 6c8297bcfeb7..188e6f79ab4e 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -188,10 +188,6 @@ static int join_running_log_trans(struct btrfs_root *root) | |||
188 | { | 188 | { |
189 | int ret = -ENOENT; | 189 | int ret = -ENOENT; |
190 | 190 | ||
191 | smp_mb(); | ||
192 | if (!root->log_root) | ||
193 | return -ENOENT; | ||
194 | |||
195 | mutex_lock(&root->log_mutex); | 191 | mutex_lock(&root->log_mutex); |
196 | if (root->log_root) { | 192 | if (root->log_root) { |
197 | ret = 0; | 193 | ret = 0; |