bcachefs: Clear k->needs_whitout earlier in commit path
authorKent Overstreet <kent.overstreet@linux.dev>
Tue, 7 Nov 2023 16:16:14 +0000 (11:16 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 1 Jan 2024 16:47:37 +0000 (11:47 -0500)
The upcoming btree write buffer rework is going to use the journal
itself as the first stage of the write buffer; this is a cleanup to make
sure k->needs_whiteout is initialized before keys hit the journal.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_trans_commit.c

index 3d66d9c..4d0f388 100644 (file)
@@ -655,6 +655,8 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
                        *stopped_at = i;
                        return ret;
                }
+
+               i->k->k.needs_whiteout = false;
        }
 
        if (trans->nr_wb_updates &&
@@ -777,8 +779,6 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
        }
 
        trans_for_each_update(trans, i) {
-               i->k->k.needs_whiteout = false;
-
                if (!i->cached) {
                        u64 seq = trans->journal_res.seq;