summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/extents.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-10-20 01:32:55 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2024-12-21 01:36:15 -0500
commit015fafc49bbf81380b65190219e530b4015cb13e (patch)
treef2360304d09a596440491b9ab04e53090acf9d87 /fs/bcachefs/extents.c
parentbcachefs: bch2_io_opts_fixups() (diff)
downloadlinux-015fafc49bbf81380b65190219e530b4015cb13e.tar.gz
linux-015fafc49bbf81380b65190219e530b4015cb13e.zip
bcachefs: small cleanup for extent ptr bitmasks
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/extents.c')
-rw-r--r--fs/bcachefs/extents.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index 45a67daf0d64..243cb15b74b3 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -1414,7 +1414,7 @@ unsigned bch2_bkey_ptrs_need_rebalance(struct bch_fs *c, struct bkey_s_c k,
unsigned compression_type = bch2_compression_opt_to_type(compression);
const union bch_extent_entry *entry;
struct extent_ptr_decoded p;
- unsigned i = 0;
+ unsigned ptr_bit = 1;
bkey_for_each_ptr_decode(k.k, ptrs, p, entry) {
if (p.crc.compression_type == BCH_COMPRESSION_TYPE_incompressible ||
@@ -1424,18 +1424,18 @@ unsigned bch2_bkey_ptrs_need_rebalance(struct bch_fs *c, struct bkey_s_c k,
}
if (!p.ptr.cached && p.crc.compression_type != compression_type)
- rewrite_ptrs |= 1U << i;
- i++;
+ rewrite_ptrs |= ptr_bit;
+ ptr_bit <<= 1;
}
}
incompressible:
if (target && bch2_target_accepts_data(c, BCH_DATA_user, target)) {
- unsigned i = 0;
+ unsigned ptr_bit = 1;
bkey_for_each_ptr(ptrs, ptr) {
if (!ptr->cached && !bch2_dev_in_target(c, ptr->dev, target))
- rewrite_ptrs |= 1U << i;
- i++;
+ rewrite_ptrs |= ptr_bit;
+ ptr_bit <<= 1;
}
}