diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-11-06 00:05:12 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:16 -0400 |
commit | 076c783cd31f0d46782f9365fd79725d1248712d (patch) | |
tree | dc45db33353c09d475885e532215316da73521cb /fs/bcachefs/buckets.c | |
parent | 68a2054d88f7cd2866806148d9a2e4389eb46992 (diff) |
bcachefs: Fix upgrade path for reflink_p fix
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/buckets.c')
-rw-r--r-- | fs/bcachefs/buckets.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index b51b1cf3ca25..d4d41646b2e6 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -1207,11 +1207,15 @@ static int bch2_mark_reflink_p(struct btree_trans *trans, struct bkey_s_c_reflink_p p = bkey_s_c_to_reflink_p(k); struct reflink_gc *ref; size_t l, r, m; - u64 idx = le64_to_cpu(p.v->idx) - le32_to_cpu(p.v->front_pad); - u64 end_idx = le64_to_cpu(p.v->idx) + p.k->size + - le32_to_cpu(p.v->back_pad); + u64 idx = le64_to_cpu(p.v->idx); + u64 end = le64_to_cpu(p.v->idx) + p.k->size; int ret = 0; + if (c->sb.version >= bcachefs_metadata_version_reflink_p_fix) { + idx -= le32_to_cpu(p.v->front_pad); + end += le32_to_cpu(p.v->back_pad); + } + l = 0; r = c->reflink_gc_nr; while (l < r) { @@ -1224,7 +1228,7 @@ static int bch2_mark_reflink_p(struct btree_trans *trans, r = m; } - while (idx < end_idx && !ret) + while (idx < end && !ret) ret = __bch2_mark_reflink_p(c, p, &idx, flags, l++); return ret; |