summaryrefslogtreecommitdiff
path: root/fs/bcachefs/reflink.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2022-11-14 02:59:01 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:51 +0300
commit792031116bee35e13be7c8ae8cf1b8eec141b136 (patch)
treef1334e71612d6af74210020546f181c259478732 /fs/bcachefs/reflink.c
parent2f1f7fe98d1da65c5ef646a90770b17cb012f1ee (diff)
downloadlinux-792031116bee35e13be7c8ae8cf1b8eec141b136.tar.xz
bcachefs: Unwritten extents support
- bch2_extent_merge checks unwritten bit - read path returns 0s for unwritten extents without actually reading - reflink path skips over unwritten extents - bch2_bkey_ptrs_invalid() checks for extents with both written and unwritten extents, and non-normal extents (stripes, btree ptrs) with unwritten ptrs - fiemap checks for unwritten extents and returns FIEMAP_EXTENT_UNWRITTEN Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/reflink.c')
-rw-r--r--fs/bcachefs/reflink.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/bcachefs/reflink.c b/fs/bcachefs/reflink.c
index aae924dc81f7..faf75bcf9ee7 100644
--- a/fs/bcachefs/reflink.c
+++ b/fs/bcachefs/reflink.c
@@ -251,9 +251,13 @@ static struct bkey_s_c get_next_src(struct btree_iter *iter, struct bpos end)
struct bkey_s_c k;
int ret;
- for_each_btree_key_upto_continue_norestart(*iter, end, 0, k, ret)
+ for_each_btree_key_upto_continue_norestart(*iter, end, 0, k, ret) {
+ if (bkey_extent_is_unwritten(k))
+ continue;
+
if (bkey_extent_is_data(k.k))
return k;
+ }
if (bkey_ge(iter->pos, end))
bch2_btree_iter_set_pos(iter, end);