btrfs: remove out label in btrfs_mark_extent_written()

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>
This commit is contained in:
Filipe Manana
2026-01-20 20:03:45 +00:00
committed by David Sterba
parent cc27540dd0
commit 610ff1c9df

View 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 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
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 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
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 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
trans->transid);
btrfs_set_file_extent_num_bytes(leaf, fi,
end - other_start);
goto out;
return 0;
}
}
@@ -660,7 +660,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
other_end - start);
btrfs_set_file_extent_offset(leaf, fi,
start - orig_offset);
goto out;
return 0;
}
}
@@ -676,7 +676,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
}
if (unlikely(ret < 0)) {
btrfs_abort_transaction(trans, ret);
goto out;
return ret;
}
leaf = path->nodes[0];
@@ -704,7 +704,7 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
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 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
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 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
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 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
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 @@ int btrfs_mark_extent_written(struct btrfs_trans_handle *trans,
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;
}
/*