]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
btrfs: Remove unnecessary check from join_running_log_trans
authorNikolay Borisov <nborisov@suse.com>
Thu, 23 May 2019 11:51:26 +0000 (14:51 +0300)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 Sep 2019 12:59:02 +0000 (14:59 +0200)
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>
fs/btrfs/tree-log.c

index 6c8297bcfeb7caa63bc2b39bdd06b5a1f7708489..188e6f79ab4efdcd997b0fc0bb7a68f9936fa3ca 100644 (file)
@@ -188,10 +188,6 @@ static int join_running_log_trans(struct btrfs_root *root)
 {
        int ret = -ENOENT;
 
-       smp_mb();
-       if (!root->log_root)
-               return -ENOENT;
-
        mutex_lock(&root->log_mutex);
        if (root->log_root) {
                ret = 0;