diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-05-23 08:31:33 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:09:05 +0200 |
commit | 890b74f03d70946e46f8169c94232fb717f46989 (patch) | |
tree | 353c9e2c7cf117149f6c2ad30a8f0c08689d52e1 /fs/bcachefs/reflink.h | |
parent | bcachefs: Assorted endianness fixes (diff) | |
download | linux-890b74f03d70946e46f8169c94232fb717f46989.tar.xz linux-890b74f03d70946e46f8169c94232fb717f46989.zip |
bcachefs: Fsck for reflink refcounts
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/reflink.h')
-rw-r--r-- | fs/bcachefs/reflink.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/bcachefs/reflink.h b/fs/bcachefs/reflink.h index 9d5e7dc58f2b..bfc785619ee8 100644 --- a/fs/bcachefs/reflink.h +++ b/fs/bcachefs/reflink.h @@ -34,6 +34,30 @@ void bch2_indirect_inline_data_to_text(struct printbuf *, .val_to_text = bch2_indirect_inline_data_to_text, \ } +static inline const __le64 *bkey_refcount_c(struct bkey_s_c k) +{ + switch (k.k->type) { + case KEY_TYPE_reflink_v: + return &bkey_s_c_to_reflink_v(k).v->refcount; + case KEY_TYPE_indirect_inline_data: + return &bkey_s_c_to_indirect_inline_data(k).v->refcount; + default: + return NULL; + } +} + +static inline __le64 *bkey_refcount(struct bkey_i *k) +{ + switch (k->k.type) { + case KEY_TYPE_reflink_v: + return &bkey_i_to_reflink_v(k)->v.refcount; + case KEY_TYPE_indirect_inline_data: + return &bkey_i_to_indirect_inline_data(k)->v.refcount; + default: + return NULL; + } +} + s64 bch2_remap_range(struct bch_fs *, struct bpos, struct bpos, u64, u64 *, u64, s64 *); |