summaryrefslogtreecommitdiff
path: root/fs/bcachefs/backpointers.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-11-17 18:26:54 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2024-12-21 01:36:19 -0500
commit1ab00b6cddc53d47e6f45002e69034941d40ae03 (patch)
tree9aca384dc21a2f35179fc1473354c35b6f92edfa /fs/bcachefs/backpointers.h
parente48fda6cdc2799ef4a63692f0f11240613067b38 (diff)
bcachefs: kill bch_backpointer.bucket_offset usage
bch_backpointer.bucket_offset is going away - it's no longer needed since we no longer store backpointers in alloc keys, the same information is in the key position itself. And we'll be reclaiming the space in bch_backpointer for the bucket generation number. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/backpointers.h')
-rw-r--r--fs/bcachefs/backpointers.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/bcachefs/backpointers.h b/fs/bcachefs/backpointers.h
index 5f34a25b599a..d8a15f5fa767 100644
--- a/fs/bcachefs/backpointers.h
+++ b/fs/bcachefs/backpointers.h
@@ -42,6 +42,14 @@ static inline struct bpos bp_pos_to_bucket(const struct bch_dev *ca, struct bpos
return POS(bp_pos.inode, sector_to_bucket(ca, bucket_sector));
}
+static inline struct bpos bp_pos_to_bucket_and_offset(const struct bch_dev *ca, struct bpos bp_pos,
+ u32 *bucket_offset)
+{
+ u64 bucket_sector = bp_pos.offset >> MAX_EXTENT_COMPRESS_RATIO_SHIFT;
+
+ return POS(bp_pos.inode, sector_to_bucket_and_offset(ca, bucket_sector, bucket_offset));
+}
+
static inline bool bp_pos_to_bucket_nodev_noerror(struct bch_fs *c, struct bpos bp_pos, struct bpos *bucket)
{
rcu_read_lock();