summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_update_interior.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-02-09 03:06:31 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:08:37 +0300
commit6357d6071fccb5ccedbe32c1e0db4443d83d28dd (patch)
tree32e2150cd5bca016dd1e081165468da0e4db6f01 /fs/bcachefs/btree_update_interior.h
parentf44a6a7134371d8b1e14055a2705d0f4da4c46d6 (diff)
downloadlinux-6357d6071fccb5ccedbe32c1e0db4443d83d28dd.tar.xz
bcachefs: Journal updates to interior nodes
Previously, the btree has always been self contained and internally consistent on disk without anything from the journal - the journal just contained pointers to the btree roots. However, this meant that btree node split or compact operations - i.e. anything that changes btree node topology and involves updates to interior nodes - would require that interior btree node to be written immediately, which means emitting a btree node write that's mostly empty (using 4k of space on disk if the filesystemm blocksize is 4k to only write perhaps ~100 bytes of new keys). More importantly, this meant most btree node writes had to be FUA, and consumer drives have a history of slow and/or buggy FUA support - other filesystes have been bit by this. This patch changes the interior btree update path to journal updates to interior nodes, after the writes for the new btree nodes have completed. Best of all, it turns out to simplify the interior node update path somewhat. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_update_interior.h')
-rw-r--r--fs/bcachefs/btree_update_interior.h16
1 files changed, 2 insertions, 14 deletions
diff --git a/fs/bcachefs/btree_update_interior.h b/fs/bcachefs/btree_update_interior.h
index f6aceed89427..4a2ea69f6a2c 100644
--- a/fs/bcachefs/btree_update_interior.h
+++ b/fs/bcachefs/btree_update_interior.h
@@ -69,8 +69,10 @@ struct btree_update {
unsigned nodes_written:1;
enum btree_id btree_id;
+ u8 level;
struct btree_reserve *reserve;
+ struct journal_preres journal_preres;
/*
* BTREE_INTERIOR_UPDATING_NODE:
@@ -84,18 +86,6 @@ struct btree_update {
struct list_head write_blocked_list;
/*
- * BTREE_INTERIOR_UPDATING_AS: btree node we updated was freed, so now
- * we're now blocking another btree_update
- * @parent_as - btree_update that's waiting on our nodes to finish
- * writing, before it can make new nodes visible on disk
- * @wait - list of child btree_updates that are waiting on this
- * btree_update to make all the new nodes visible before they can free
- * their old btree nodes
- */
- struct btree_update *parent_as;
- struct closure_waitlist wait;
-
- /*
* We may be freeing nodes that were dirty, and thus had journal entries
* pinned: we need to transfer the oldest of those pins to the
* btree_update operation, and release it when the new node(s)
@@ -103,8 +93,6 @@ struct btree_update {
*/
struct journal_entry_pin journal;
- u64 journal_seq;
-
/*
* Nodes being freed:
* Protected by c->btree_node_pending_free_lock