77 lines
3.0 KiB
Diff
77 lines
3.0 KiB
Diff
From da89857b5fee06e4424cc235c2534edd4621dc6f Mon Sep 17 00:00:00 2001
|
|
From: Kent Overstreet <kent.overstreet@linux.dev>
|
|
Date: Sun, 17 Nov 2024 18:26:54 -0500
|
|
Subject: [PATCH 108/233] bcachefs: kill bch_backpointer.bucket_offset usage
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
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>
|
|
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
|
---
|
|
fs/bcachefs/backpointers.c | 15 +++++++--------
|
|
fs/bcachefs/backpointers.h | 8 ++++++++
|
|
2 files changed, 15 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c
|
|
index 5963217cd90c..620fa67db7a6 100644
|
|
--- a/fs/bcachefs/backpointers.c
|
|
+++ b/fs/bcachefs/backpointers.c
|
|
@@ -54,21 +54,20 @@ void bch2_backpointer_to_text(struct printbuf *out, struct bch_fs *c, struct bke
|
|
struct bkey_s_c_backpointer bp = bkey_s_c_to_backpointer(k);
|
|
|
|
rcu_read_lock();
|
|
- struct bch_dev *ca = bch2_dev_rcu_noerror(c, k.k->p.inode);
|
|
+ struct bch_dev *ca = bch2_dev_rcu_noerror(c, bp.k->p.inode);
|
|
if (ca) {
|
|
- struct bpos bucket = bp_pos_to_bucket(ca, k.k->p);
|
|
+ u32 bucket_offset;
|
|
+ struct bpos bucket = bp_pos_to_bucket_and_offset(ca, bp.k->p, &bucket_offset);
|
|
rcu_read_unlock();
|
|
- prt_str(out, "bucket=");
|
|
- bch2_bpos_to_text(out, bucket);
|
|
- prt_str(out, " ");
|
|
+ prt_printf(out, "bucket=%llu:%llu:%u", bucket.inode, bucket.offset, bucket_offset);
|
|
} else {
|
|
rcu_read_unlock();
|
|
+ prt_printf(out, "sector=%llu:%llu", bp.k->p.inode, bp.k->p.offset >> MAX_EXTENT_COMPRESS_RATIO_SHIFT);
|
|
}
|
|
|
|
bch2_btree_id_level_to_text(out, bp.v->btree_id, bp.v->level);
|
|
- prt_printf(out, " offset=%llu:%u len=%u pos=",
|
|
- (u64) (bp.v->bucket_offset >> MAX_EXTENT_COMPRESS_RATIO_SHIFT),
|
|
- (u32) bp.v->bucket_offset & ~(~0U << MAX_EXTENT_COMPRESS_RATIO_SHIFT),
|
|
+ prt_printf(out, " suboffset=%u len=%u pos=",
|
|
+ (u32) bp.k->p.offset & ~(~0U << MAX_EXTENT_COMPRESS_RATIO_SHIFT),
|
|
bp.v->bucket_len);
|
|
bch2_bpos_to_text(out, bp.v->pos);
|
|
}
|
|
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();
|
|
--
|
|
2.45.2
|
|
|