Commit 076c783c authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix upgrade path for reflink_p fix

Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 68a2054d
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment