diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-31 06:40:19 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:28 +0300 |
commit | 1296ab552040e09b35f37b8c523d4f1711ac8435 (patch) | |
tree | 018def7f7b72e2449937f9720d7b779008e91056 /fs/bcachefs/super.h | |
parent | 5aabb32442c44c9cfc41a2c29638aebeb3e9cb26 (diff) | |
download | linux-1296ab552040e09b35f37b8c523d4f1711ac8435.tar.xz |
bcachefs: Improve bch2_bkey_ptrs_to_text()
Print bucket:offset when the filesystem is online; this makes debugging
easier when correlating with alloc updates.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/super.h')
-rw-r--r-- | fs/bcachefs/super.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/bcachefs/super.h b/fs/bcachefs/super.h index 6414f6a6bb91..359fa1e7fc18 100644 --- a/fs/bcachefs/super.h +++ b/fs/bcachefs/super.h @@ -26,6 +26,12 @@ static inline sector_t bucket_remainder(const struct bch_dev *ca, sector_t s) return remainder; } +static inline size_t sector_to_bucket_and_offset(const struct bch_dev *ca, sector_t s, + u32 *offset) +{ + return div_u64_rem(s, ca->mi.bucket_size, offset); +} + static inline bool bch2_dev_is_online(struct bch_dev *ca) { return !percpu_ref_is_zero(&ca->io_ref); |