Linux Audio

Check our new training course

Loading...
v6.8
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef _BCACHEFS_REFLINK_H
 3#define _BCACHEFS_REFLINK_H
 4
 5enum bkey_invalid_flags;
 6
 7int bch2_reflink_p_invalid(struct bch_fs *, struct bkey_s_c,
 8			   enum bkey_invalid_flags, struct printbuf *);
 9void bch2_reflink_p_to_text(struct printbuf *, struct bch_fs *,
10			    struct bkey_s_c);
11bool bch2_reflink_p_merge(struct bch_fs *, struct bkey_s, struct bkey_s_c);
12int bch2_trigger_reflink_p(struct btree_trans *, enum btree_id, unsigned,
13			   struct bkey_s_c, struct bkey_s, unsigned);
 
14
15#define bch2_bkey_ops_reflink_p ((struct bkey_ops) {		\
16	.key_invalid	= bch2_reflink_p_invalid,		\
17	.val_to_text	= bch2_reflink_p_to_text,		\
18	.key_merge	= bch2_reflink_p_merge,			\
19	.trigger	= bch2_trigger_reflink_p,		\
20	.min_val_size	= 16,					\
21})
22
23int bch2_reflink_v_invalid(struct bch_fs *, struct bkey_s_c,
24			   enum bkey_invalid_flags, struct printbuf *);
25void bch2_reflink_v_to_text(struct printbuf *, struct bch_fs *,
26			    struct bkey_s_c);
27int bch2_trigger_reflink_v(struct btree_trans *, enum btree_id, unsigned,
28			      struct bkey_s_c, struct bkey_s, unsigned);
 
29
30#define bch2_bkey_ops_reflink_v ((struct bkey_ops) {		\
31	.key_invalid	= bch2_reflink_v_invalid,		\
32	.val_to_text	= bch2_reflink_v_to_text,		\
33	.swab		= bch2_ptr_swab,			\
34	.trigger	= bch2_trigger_reflink_v,		\
35	.min_val_size	= 8,					\
36})
37
38int bch2_indirect_inline_data_invalid(struct bch_fs *, struct bkey_s_c,
39				      enum bkey_invalid_flags, struct printbuf *);
40void bch2_indirect_inline_data_to_text(struct printbuf *,
41				struct bch_fs *, struct bkey_s_c);
42int bch2_trigger_indirect_inline_data(struct btree_trans *,
43					 enum btree_id, unsigned,
44			      struct bkey_s_c, struct bkey_s,
45			      unsigned);
46
47#define bch2_bkey_ops_indirect_inline_data ((struct bkey_ops) {	\
48	.key_invalid	= bch2_indirect_inline_data_invalid,	\
49	.val_to_text	= bch2_indirect_inline_data_to_text,	\
50	.trigger	= bch2_trigger_indirect_inline_data,	\
51	.min_val_size	= 8,					\
52})
53
54static inline const __le64 *bkey_refcount_c(struct bkey_s_c k)
55{
56	switch (k.k->type) {
57	case KEY_TYPE_reflink_v:
58		return &bkey_s_c_to_reflink_v(k).v->refcount;
59	case KEY_TYPE_indirect_inline_data:
60		return &bkey_s_c_to_indirect_inline_data(k).v->refcount;
61	default:
62		return NULL;
63	}
64}
65
66static inline __le64 *bkey_refcount(struct bkey_s k)
67{
68	switch (k.k->type) {
69	case KEY_TYPE_reflink_v:
70		return &bkey_s_to_reflink_v(k).v->refcount;
71	case KEY_TYPE_indirect_inline_data:
72		return &bkey_s_to_indirect_inline_data(k).v->refcount;
73	default:
74		return NULL;
75	}
76}
77
78s64 bch2_remap_range(struct bch_fs *, subvol_inum, u64,
79		     subvol_inum, u64, u64, u64, s64 *);
80
81#endif /* _BCACHEFS_REFLINK_H */
v6.13.7
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef _BCACHEFS_REFLINK_H
 3#define _BCACHEFS_REFLINK_H
 4
 5enum bch_validate_flags;
 6
 7int bch2_reflink_p_validate(struct bch_fs *, struct bkey_s_c, enum bch_validate_flags);
 8void bch2_reflink_p_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
 
 
 9bool bch2_reflink_p_merge(struct bch_fs *, struct bkey_s, struct bkey_s_c);
10int bch2_trigger_reflink_p(struct btree_trans *, enum btree_id, unsigned,
11			   struct bkey_s_c, struct bkey_s,
12			   enum btree_iter_update_trigger_flags);
13
14#define bch2_bkey_ops_reflink_p ((struct bkey_ops) {		\
15	.key_validate	= bch2_reflink_p_validate,		\
16	.val_to_text	= bch2_reflink_p_to_text,		\
17	.key_merge	= bch2_reflink_p_merge,			\
18	.trigger	= bch2_trigger_reflink_p,		\
19	.min_val_size	= 16,					\
20})
21
22int bch2_reflink_v_validate(struct bch_fs *, struct bkey_s_c, enum bch_validate_flags);
23void bch2_reflink_v_to_text(struct printbuf *, struct bch_fs *, struct bkey_s_c);
 
 
24int bch2_trigger_reflink_v(struct btree_trans *, enum btree_id, unsigned,
25			   struct bkey_s_c, struct bkey_s,
26			   enum btree_iter_update_trigger_flags);
27
28#define bch2_bkey_ops_reflink_v ((struct bkey_ops) {		\
29	.key_validate	= bch2_reflink_v_validate,		\
30	.val_to_text	= bch2_reflink_v_to_text,		\
31	.swab		= bch2_ptr_swab,			\
32	.trigger	= bch2_trigger_reflink_v,		\
33	.min_val_size	= 8,					\
34})
35
36int bch2_indirect_inline_data_validate(struct bch_fs *, struct bkey_s_c,
37				      enum bch_validate_flags);
38void bch2_indirect_inline_data_to_text(struct printbuf *,
39				struct bch_fs *, struct bkey_s_c);
40int bch2_trigger_indirect_inline_data(struct btree_trans *,
41					 enum btree_id, unsigned,
42			      struct bkey_s_c, struct bkey_s,
43			      enum btree_iter_update_trigger_flags);
44
45#define bch2_bkey_ops_indirect_inline_data ((struct bkey_ops) {	\
46	.key_validate	= bch2_indirect_inline_data_validate,	\
47	.val_to_text	= bch2_indirect_inline_data_to_text,	\
48	.trigger	= bch2_trigger_indirect_inline_data,	\
49	.min_val_size	= 8,					\
50})
51
52static inline const __le64 *bkey_refcount_c(struct bkey_s_c k)
53{
54	switch (k.k->type) {
55	case KEY_TYPE_reflink_v:
56		return &bkey_s_c_to_reflink_v(k).v->refcount;
57	case KEY_TYPE_indirect_inline_data:
58		return &bkey_s_c_to_indirect_inline_data(k).v->refcount;
59	default:
60		return NULL;
61	}
62}
63
64static inline __le64 *bkey_refcount(struct bkey_s k)
65{
66	switch (k.k->type) {
67	case KEY_TYPE_reflink_v:
68		return &bkey_s_to_reflink_v(k).v->refcount;
69	case KEY_TYPE_indirect_inline_data:
70		return &bkey_s_to_indirect_inline_data(k).v->refcount;
71	default:
72		return NULL;
73	}
74}
75
76s64 bch2_remap_range(struct bch_fs *, subvol_inum, u64,
77		     subvol_inum, u64, u64, u64, s64 *);
78
79#endif /* _BCACHEFS_REFLINK_H */