summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/transaction.c
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2023-09-08 18:20:20 +0100
committerDavid Sterba <dsterba@suse.com>2023-10-12 16:44:05 +0200
commit03551d651e9d8ff5b310f9038581b2b030daeb87 (patch)
treebffe565c1936e8c6a1c4837a07bb956fbf1484d9 /fs/btrfs/transaction.c
parent9fb2acc2fe07f15b6cfe94a4bf910d3dfcd6e127 (diff)
downloadlinux-stable-03551d651e9d8ff5b310f9038581b2b030daeb87.tar.gz
linux-stable-03551d651e9d8ff5b310f9038581b2b030daeb87.tar.bz2
linux-stable-03551d651e9d8ff5b310f9038581b2b030daeb87.zip
btrfs: pass a space_info argument to btrfs_reserve_metadata_bytes()
We are passing a block reserve argument to btrfs_reserve_metadata_bytes() which is not really used, all we need is to pass the space_info associated to the block reserve, we don't change the block reserve at all. Not only it's pointless to pass the block reserve, it's also confusing as one might think that the reserved bytes will end up being added to the passed block reserve, when that's not the case. The pattern for reserving space and adding it to a block reserve is to first reserve space with btrfs_reserve_metadata_bytes() and if that succeeds, then add the space to a block reserve by calling btrfs_block_rsv_add_bytes(). Also the reverse of btrfs_reserve_metadata_bytes(), which is btrfs_space_info_free_bytes_may_use(), takes a space_info argument and not a block reserve, so one more reason to pass a space_info and not a block reserve to btrfs_reserve_metadata_bytes(). So change btrfs_reserve_metadata_bytes() and its callers to pass a space_info argument instead of a block reserve argument. Reviewed-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/transaction.c')
-rw-r--r--fs/btrfs/transaction.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index be27360843df..91a66bc775c8 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -631,7 +631,8 @@ start_transaction(struct btrfs_root *root, unsigned int num_items,
reloc_reserved = true;
}
- ret = btrfs_reserve_metadata_bytes(fs_info, rsv, num_bytes, flush);
+ ret = btrfs_reserve_metadata_bytes(fs_info, rsv->space_info,
+ num_bytes, flush);
if (ret)
goto reserve_fail;
if (delayed_refs_bytes) {