summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_update_interior.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-03-14 21:48:42 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:29 -0400
commit31f63fd1244d9609265eb5cfc522c142b35cdacc (patch)
treeba7e780ac34fe7ce6f6647b0a47f4da301b26d83 /fs/bcachefs/btree_update_interior.c
parentd905f67ec89fda758bcfa70d0b5c3d3006bbdb3e (diff)
bcachefs: Introduce a separate journal watermark for copygc
Since journal reclaim -> btree key cache flushing may require the allocation of new btree nodes, it has an implicit dependency on copygc in order to make forward progress - so we should avoid blocking copygc unless the journal is really close to full. This introduces watermarks to replace our single MAY_GET_UNRESERVED bit in the journal, and adds a watermark for copygc and plumbs it through. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_update_interior.c')
-rw-r--r--fs/bcachefs/btree_update_interior.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index 1c53f965539d..cd4332f891dc 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -599,7 +599,7 @@ static void btree_update_nodes_written(struct btree_update *as)
BTREE_INSERT_NOFAIL|
BTREE_INSERT_NOCHECK_RW|
BTREE_INSERT_JOURNAL_RECLAIM|
- BTREE_INSERT_JOURNAL_RESERVED,
+ JOURNAL_WATERMARK_reserved,
btree_update_nodes_written_trans(&trans, as));
bch2_trans_exit(&trans);
@@ -964,14 +964,11 @@ bch2_btree_update_start(struct btree_trans *trans, struct btree_path *path,
? BCH_DISK_RESERVATION_NOFAIL : 0;
unsigned nr_nodes[2];
unsigned update_level = level;
- int journal_flags = 0;
+ int journal_flags = flags & JOURNAL_WATERMARK_MASK;
int ret = 0;
BUG_ON(!path->should_be_locked);
- if (flags & BTREE_INSERT_JOURNAL_RESERVED)
- journal_flags |= JOURNAL_RES_GET_RESERVED;
-
closure_init_stack(&cl);
retry:
nr_nodes[0] = nr_nodes[1] = 0;
@@ -1972,7 +1969,7 @@ static int __bch2_btree_node_update_key(struct btree_trans *trans,
BTREE_INSERT_NOCHECK_RW|
BTREE_INSERT_USE_RESERVE|
BTREE_INSERT_JOURNAL_RECLAIM|
- BTREE_INSERT_JOURNAL_RESERVED);
+ JOURNAL_WATERMARK_reserved);
if (ret)
goto err;