btrfs: remove pointless label and goto at btrfs_record_unlink_dir()
authorFilipe Manana <fdmanana@suse.com>
Wed, 17 May 2023 11:02:15 +0000 (12:02 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 19 Jun 2023 11:59:26 +0000 (13:59 +0200)
There's no point of having a label and goto at btrfs_record_unlink_dir()
because the function is trivial and can just return early if we are not
in a rename context. So remove the label and goto and instead return
early if we are not in a rename.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-log.c

index 95d01a122b3f638aaaa357e0df64f63951076c29..c988eae6a4f2bedbf7080072e516a364b2a2d53b 100644 (file)
@@ -7325,6 +7325,9 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
        inode->last_unlink_trans = trans->transid;
        mutex_unlock(&inode->log_mutex);
 
+       if (!for_rename)
+               return;
+
        /*
         * If this directory was already logged, any new names will be logged
         * with btrfs_log_new_name() and old names will be deleted from the log
@@ -7350,13 +7353,6 @@ void btrfs_record_unlink_dir(struct btrfs_trans_handle *trans,
         * properly.  So, we have to be conservative and force commits
         * so the new name gets discovered.
         */
-       if (for_rename)
-               goto record;
-
-       /* we can safely do the unlink without any special recording */
-       return;
-
-record:
        mutex_lock(&dir->log_mutex);
        dir->last_unlink_trans = trans->transid;
        mutex_unlock(&dir->log_mutex);