Commit aa8982c3 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix reflink repair code

The reflink repair code was incorrectly inserting a nonzero deleted key
via journal replay - this is due to bch2_journal_key_insert() being
somewhat hacky, and so this fix is also hacky for now.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent c45c8667
...@@ -1501,10 +1501,18 @@ static int bch2_gc_reflink_done(struct bch_fs *c, bool initial, ...@@ -1501,10 +1501,18 @@ static int bch2_gc_reflink_done(struct bch_fs *c, bool initial,
bkey_reassemble(new, k); bkey_reassemble(new, k);
if (!r->refcount) if (!r->refcount) {
new->k.type = KEY_TYPE_deleted; new->k.type = KEY_TYPE_deleted;
else /*
* XXX ugly: bch2_journal_key_insert() queues up
* the key for the journal replay code, which
* doesn't run the extent overwrite pass
*/
if (initial)
new->k.size = 0;
} else {
*bkey_refcount(new) = cpu_to_le64(r->refcount); *bkey_refcount(new) = cpu_to_le64(r->refcount);
}
ret = initial ret = initial
? bch2_journal_key_insert(c, BTREE_ID_stripes, 0, new) ? bch2_journal_key_insert(c, BTREE_ID_stripes, 0, new)
......
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