1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_REFLINK_H
3 #define _BCACHEFS_REFLINK_H
5 int bch2_reflink_p_invalid(const struct bch_fs *, struct bkey_s_c,
6 int, struct printbuf *);
7 void bch2_reflink_p_to_text(struct printbuf *, struct bch_fs *,
9 bool bch2_reflink_p_merge(struct bch_fs *, struct bkey_s, struct bkey_s_c);
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, \
15 .trans_trigger = bch2_trans_mark_reflink_p, \
16 .atomic_trigger = bch2_mark_reflink_p, \
19 int bch2_reflink_v_invalid(const struct bch_fs *, struct bkey_s_c,
20 int, struct printbuf *);
21 void bch2_reflink_v_to_text(struct printbuf *, struct bch_fs *,
23 int bch2_trans_mark_reflink_v(struct btree_trans *, enum btree_id, unsigned,
24 struct bkey_s_c, struct bkey_i *, unsigned);
26 #define bch2_bkey_ops_reflink_v (struct bkey_ops) { \
27 .key_invalid = bch2_reflink_v_invalid, \
28 .val_to_text = bch2_reflink_v_to_text, \
29 .swab = bch2_ptr_swab, \
30 .trans_trigger = bch2_trans_mark_reflink_v, \
31 .atomic_trigger = bch2_mark_extent, \
34 int bch2_indirect_inline_data_invalid(const struct bch_fs *, struct bkey_s_c,
35 int, struct printbuf *);
36 void bch2_indirect_inline_data_to_text(struct printbuf *,
37 struct bch_fs *, struct bkey_s_c);
38 int bch2_trans_mark_indirect_inline_data(struct btree_trans *,
39 enum btree_id, unsigned,
40 struct bkey_s_c, struct bkey_i *,
43 #define bch2_bkey_ops_indirect_inline_data (struct bkey_ops) { \
44 .key_invalid = bch2_indirect_inline_data_invalid, \
45 .val_to_text = bch2_indirect_inline_data_to_text, \
46 .trans_trigger = bch2_trans_mark_indirect_inline_data, \
49 static inline const __le64 *bkey_refcount_c(struct bkey_s_c k)
52 case KEY_TYPE_reflink_v:
53 return &bkey_s_c_to_reflink_v(k).v->refcount;
54 case KEY_TYPE_indirect_inline_data:
55 return &bkey_s_c_to_indirect_inline_data(k).v->refcount;
61 static inline __le64 *bkey_refcount(struct bkey_i *k)
64 case KEY_TYPE_reflink_v:
65 return &bkey_i_to_reflink_v(k)->v.refcount;
66 case KEY_TYPE_indirect_inline_data:
67 return &bkey_i_to_indirect_inline_data(k)->v.refcount;
73 s64 bch2_remap_range(struct bch_fs *, subvol_inum, u64,
74 subvol_inum, u64, u64, u64, s64 *);
76 #endif /* _BCACHEFS_REFLINK_H */