summaryrefslogtreecommitdiff
path: root/libbcachefs/reflink.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-05-31 15:05:33 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2021-05-31 15:05:33 -0400
commitb61ad35b974038fd1b0396c51a61d84891ae0523 (patch)
tree44a7509361fcafb2da3c4dc923735973da23a7b4 /libbcachefs/reflink.h
parent4a2acdaf65c67d87133f93db0a7087f74134099c (diff)
Update bcachefs sources to 3913e0cac3 bcachefs: Journal space calculation fix
Diffstat (limited to 'libbcachefs/reflink.h')
-rw-r--r--libbcachefs/reflink.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/libbcachefs/reflink.h b/libbcachefs/reflink.h
index 9d5e7dc5..bfc78561 100644
--- a/libbcachefs/reflink.h
+++ b/libbcachefs/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 *);