summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/extents.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2019-08-16 09:59:56 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:25 -0400
commit76426098e419c1732efc3f88166f3f3592c215c9 (patch)
tree1cc431e32b7129a573116ce43307e9bc47d76b1d /fs/bcachefs/extents.h
parent3c7f3b7aeb73f2155aec9d00567b70ef55ede465 (diff)
downloadlinux-stable-76426098e419c1732efc3f88166f3f3592c215c9.tar.gz
linux-stable-76426098e419c1732efc3f88166f3f3592c215c9.tar.bz2
linux-stable-76426098e419c1732efc3f88166f3f3592c215c9.zip
bcachefs: Reflink
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/extents.h')
-rw-r--r--fs/bcachefs/extents.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/fs/bcachefs/extents.h b/fs/bcachefs/extents.h
index 156d8e37045a..cef93af25858 100644
--- a/fs/bcachefs/extents.h
+++ b/fs/bcachefs/extents.h
@@ -306,6 +306,14 @@ static inline struct bkey_ptrs_c bch2_bkey_ptrs_c(struct bkey_s_c k)
to_entry(&s.v->ptrs[s.v->nr_blocks]),
};
}
+ case KEY_TYPE_reflink_v: {
+ struct bkey_s_c_reflink_v r = bkey_s_c_to_reflink_v(k);
+
+ return (struct bkey_ptrs_c) {
+ r.v->start,
+ bkey_val_end(r),
+ };
+ }
default:
return (struct bkey_ptrs_c) { NULL, NULL };
}
@@ -436,8 +444,8 @@ bch2_extent_can_insert(struct btree_trans *, struct btree_insert_entry *,
void bch2_insert_fixup_extent(struct btree_trans *,
struct btree_insert_entry *);
-void bch2_extent_mark_replicas_cached(struct bch_fs *, struct bkey_s_extent,
- unsigned, unsigned);
+void bch2_bkey_mark_replicas_cached(struct bch_fs *, struct bkey_s,
+ unsigned, unsigned);
const struct bch_extent_ptr *
bch2_extent_has_device(struct bkey_s_c_extent, unsigned);
@@ -452,17 +460,24 @@ static inline bool bkey_extent_is_data(const struct bkey *k)
switch (k->type) {
case KEY_TYPE_btree_ptr:
case KEY_TYPE_extent:
+ case KEY_TYPE_reflink_p:
+ case KEY_TYPE_reflink_v:
return true;
default:
return false;
}
}
+/*
+ * Should extent be counted under inode->i_sectors?
+ */
static inline bool bkey_extent_is_allocation(const struct bkey *k)
{
switch (k->type) {
case KEY_TYPE_extent:
case KEY_TYPE_reservation:
+ case KEY_TYPE_reflink_p:
+ case KEY_TYPE_reflink_v:
return true;
default:
return false;