1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_REFLINK_H
3 #define _BCACHEFS_REFLINK_H
5 const char *bch2_reflink_p_invalid(const struct bch_fs *, struct bkey_s_c);
6 void bch2_reflink_p_to_text(struct printbuf *, struct bch_fs *,
8 enum merge_result bch2_reflink_p_merge(struct bch_fs *,
9 struct bkey_s, struct bkey_s);
11 #define bch2_bkey_ops_reflink_p (struct bkey_ops) { \
12 .key_invalid = bch2_reflink_p_invalid, \
13 .val_to_text = bch2_reflink_p_to_text, \
14 .key_merge = bch2_reflink_p_merge, \
17 const char *bch2_reflink_v_invalid(const struct bch_fs *, struct bkey_s_c);
18 void bch2_reflink_v_to_text(struct printbuf *, struct bch_fs *,
21 #define bch2_bkey_ops_reflink_v (struct bkey_ops) { \
22 .key_invalid = bch2_reflink_v_invalid, \
23 .val_to_text = bch2_reflink_v_to_text, \
24 .swab = bch2_ptr_swab, \
27 const char *bch2_indirect_inline_data_invalid(const struct bch_fs *,
29 void bch2_indirect_inline_data_to_text(struct printbuf *,
30 struct bch_fs *, struct bkey_s_c);
32 #define bch2_bkey_ops_indirect_inline_data (struct bkey_ops) { \
33 .key_invalid = bch2_indirect_inline_data_invalid, \
34 .val_to_text = bch2_indirect_inline_data_to_text, \
37 static inline const __le64 *bkey_refcount_c(struct bkey_s_c k)
40 case KEY_TYPE_reflink_v:
41 return &bkey_s_c_to_reflink_v(k).v->refcount;
42 case KEY_TYPE_indirect_inline_data:
43 return &bkey_s_c_to_indirect_inline_data(k).v->refcount;
49 static inline __le64 *bkey_refcount(struct bkey_i *k)
52 case KEY_TYPE_reflink_v:
53 return &bkey_i_to_reflink_v(k)->v.refcount;
54 case KEY_TYPE_indirect_inline_data:
55 return &bkey_i_to_indirect_inline_data(k)->v.refcount;
61 s64 bch2_remap_range(struct bch_fs *, struct bpos, struct bpos,
62 u64, u64 *, u64, s64 *);
64 #endif /* _BCACHEFS_REFLINK_H */