btrfs: remove out label in btrfs_mark_extent_written()
authorFilipe Manana <fdmanana@suse.com>
Tue, 20 Jan 2026 20:03:45 +0000 (20:03 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 06:56:22 +0000 (07:56 +0100)
There is no point in having the label since all it does is return the
value in the 'ret' variable. Instead make every goto return directly
and remove the label.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
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/file.c

index 1759776..56ece11 100644 (file)
@@ -565,7 +565,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
        int del_nr = 0;
        int del_slot = 0;
        int recow;
-       int ret = 0;
+       int ret;
        u64 ino = btrfs_ino(inode);
 
        path = btrfs_alloc_path();
@@ -580,7 +580,7 @@ again:
 
        ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
        if (ret < 0)
-               goto out;
+               return ret;
        if (ret > 0 && path->slots[0] > 0)
                path->slots[0]--;
 
@@ -589,20 +589,20 @@ again:
        if (unlikely(key.objectid != ino || key.type != BTRFS_EXTENT_DATA_KEY)) {
                ret = -EINVAL;
                btrfs_abort_transaction(trans, ret);
-               goto out;
+               return ret;
        }
        fi = btrfs_item_ptr(leaf, path->slots[0],
                            struct btrfs_file_extent_item);
        if (unlikely(btrfs_file_extent_type(leaf, fi) != BTRFS_FILE_EXTENT_PREALLOC)) {
                ret = -EINVAL;
                btrfs_abort_transaction(trans, ret);
-               goto out;
+               return ret;
        }
        extent_end = key.offset + btrfs_file_extent_num_bytes(leaf, fi);
        if (unlikely(key.offset > start || extent_end < end)) {
                ret = -EINVAL;
                btrfs_abort_transaction(trans, ret);
-               goto out;
+               return ret;
        }
 
        bytenr = btrfs_file_extent_disk_bytenr(leaf, fi);
@@ -632,7 +632,7 @@ again:
                                                         trans->transid);
                        btrfs_set_file_extent_num_bytes(leaf, fi,
                                                        end - other_start);
-                       goto out;
+                       return 0;
                }
        }
 
@@ -660,7 +660,7 @@ again:
                                                        other_end - start);
                        btrfs_set_file_extent_offset(leaf, fi,
                                                     start - orig_offset);
-                       goto out;
+                       return 0;
                }
        }
 
@@ -676,7 +676,7 @@ again:
                }
                if (unlikely(ret < 0)) {
                        btrfs_abort_transaction(trans, ret);
-                       goto out;
+                       return ret;
                }
 
                leaf = path->nodes[0];
@@ -704,7 +704,7 @@ again:
                ret = btrfs_inc_extent_ref(trans, &ref);
                if (unlikely(ret)) {
                        btrfs_abort_transaction(trans, ret);
-                       goto out;
+                       return ret;
                }
 
                if (split == start) {
@@ -713,7 +713,7 @@ again:
                        if (unlikely(start != key.offset)) {
                                ret = -EINVAL;
                                btrfs_abort_transaction(trans, ret);
-                               goto out;
+                               return ret;
                        }
                        path->slots[0]--;
                        extent_end = end;
@@ -744,7 +744,7 @@ again:
                ret = btrfs_free_extent(trans, &ref);
                if (unlikely(ret)) {
                        btrfs_abort_transaction(trans, ret);
-                       goto out;
+                       return ret;
                }
        }
        other_start = 0;
@@ -762,7 +762,7 @@ again:
                ret = btrfs_free_extent(trans, &ref);
                if (unlikely(ret)) {
                        btrfs_abort_transaction(trans, ret);
-                       goto out;
+                       return ret;
                }
        }
        if (del_nr == 0) {
@@ -783,11 +783,11 @@ again:
                ret = btrfs_del_items(trans, root, path, del_slot, del_nr);
                if (unlikely(ret < 0)) {
                        btrfs_abort_transaction(trans, ret);
-                       goto out;
+                       return ret;
                }
        }
-out:
-       return ret;
+
+       return 0;
 }
 
 /*