diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2022-11-13 18:59:01 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:51 -0400 |
commit | 792031116bee35e13be7c8ae8cf1b8eec141b136 (patch) | |
tree | f1334e71612d6af74210020546f181c259478732 /fs/bcachefs/reflink.c | |
parent | 2f1f7fe98d1da65c5ef646a90770b17cb012f1ee (diff) | |
download | linux-792031116bee35e13be7c8ae8cf1b8eec141b136.tar.gz linux-792031116bee35e13be7c8ae8cf1b8eec141b136.tar.bz2 linux-792031116bee35e13be7c8ae8cf1b8eec141b136.zip |
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.c | 6 |
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); |