From eabb10dc9561525661d4fda229134a6f8716e007 Mon Sep 17 00:00:00 2001 From: Brian Foster Date: Wed, 19 Jul 2023 08:53:05 -0400 Subject: bcachefs: support btree updates of prejournaled keys Introduce support for prejournaled key updates. This allows a transaction to commit an update for a key that already exists (and is pinned) in the journal. This is required for btree write buffer updates as the current scheme of journaling both on write buffer insertion and write buffer (slow path) flush is unsafe in certain crash recovery scenarios. Create a small trans update wrapper to pass along the seq where the key resides into the btree_insert_entry. From there, trans commit passes the seq into the btree insert path where it is used to manage the journal pin for the associated btree leaf. Note that this patch only introduces the underlying mechanism and otherwise includes no functional changes. Signed-off-by: Brian Foster Signed-off-by: Kent Overstreet --- fs/bcachefs/btree_types.h | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/bcachefs/btree_types.h') diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h index 937f9c2b63ed..9bfaa15d5ad4 100644 --- a/fs/bcachefs/btree_types.h +++ b/fs/bcachefs/btree_types.h @@ -380,6 +380,7 @@ struct btree_insert_entry { u8 old_btree_u64s; struct bkey_i *k; struct btree_path *path; + u64 seq; /* key being overwritten: */ struct bkey old_k; const struct bch_val *old_v; -- cgit v1.2.3