summaryrefslogtreecommitdiff
path: root/fs/btrfs/relocation.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2026-05-27 13:16:52 +0200
committerJohannes Thumshirn <johannes.thumshirn@wdc.com>2026-06-09 18:22:45 +0200
commit422ccdfe22c26c72246ca8ca1f90524be95055ef (patch)
tree778849a1761980f662eb16579a53a61d69c0ee24 /fs/btrfs/relocation.c
parent532085d00eb54c074bdeae648b194765239f4d11 (diff)
downloadlinux-next-422ccdfe22c26c72246ca8ca1f90524be95055ef.tar.gz
linux-next-422ccdfe22c26c72246ca8ca1f90524be95055ef.zip
btrfs: use shifts for sectorsize and nodesize
Convert more multiplications of sectorsize or nodesize to use the shifts. The remaining cases are multiplications by constants that compiler can optimize by itself, and in tests. Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Boris Burkov <boris@bur.io> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r--fs/btrfs/relocation.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 2b11eda49c06..9469f8982355 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1574,7 +1574,7 @@ static noinline_for_stack int merge_reloc_root(struct reloc_control *rc,
* and * 2 since we have two trees to COW.
*/
reserve_level = max_t(int, 1, btrfs_root_level(root_item));
- min_reserved = fs_info->nodesize * reserve_level * 2;
+ min_reserved = (reserve_level << fs_info->nodesize_bits) * 2;
memset(&next_key, 0, sizeof(next_key));
while (1) {
@@ -2572,7 +2572,7 @@ static int relocate_cowonly_block(struct btrfs_trans_handle *trans,
nr_levels = max(btrfs_header_level(root->node) - block->level, 0) + 1;
- num_bytes = fs_info->nodesize * nr_levels;
+ num_bytes = (nr_levels << fs_info->nodesize_bits);
ret = refill_metadata_space(trans, rc, num_bytes);
if (ret) {
btrfs_put_root(root);