summaryrefslogtreecommitdiff
path: root/fs/bcachefs/btree_io.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-07-11 16:41:14 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:08 -0400
commit0a70089062c63b0861217d9ffb76d3ac073d3fde (patch)
tree6ad36372483f209b4145ec231000276888873d9f /fs/bcachefs/btree_io.h
parent2680325b7803c336bb675addfe38c06c44e54273 (diff)
bcachefs: Kick off btree node writes from write completions
This is a performance improvement by removing the need to wait for the in flight btree write to complete before kicking one off, which is going to be needed to avoid a performance regression with the upcoming patch to update btree ptrs after every btree write. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/btree_io.h')
-rw-r--r--fs/bcachefs/btree_io.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/fs/bcachefs/btree_io.h b/fs/bcachefs/btree_io.h
index 89fd4aba5218..3732d135de8d 100644
--- a/fs/bcachefs/btree_io.h
+++ b/fs/bcachefs/btree_io.h
@@ -139,7 +139,7 @@ void bch2_btree_complete_write(struct bch_fs *, struct btree *,
struct btree_write *);
void bch2_btree_write_error_work(struct work_struct *);
-void __bch2_btree_node_write(struct bch_fs *, struct btree *);
+void __bch2_btree_node_write(struct bch_fs *, struct btree *, bool);
bool bch2_btree_post_write_cleanup(struct bch_fs *, struct btree *);
void bch2_btree_node_write(struct bch_fs *, struct btree *,
@@ -148,18 +148,11 @@ void bch2_btree_node_write(struct bch_fs *, struct btree *,
static inline void btree_node_write_if_need(struct bch_fs *c, struct btree *b,
enum six_lock_type lock_held)
{
- while (b->written &&
- btree_node_need_write(b) &&
- btree_node_may_write(b)) {
- if (!btree_node_write_in_flight(b)) {
- bch2_btree_node_write(c, b, lock_held);
- break;
- }
-
- six_unlock_type(&b->c.lock, lock_held);
- bch2_btree_node_wait_on_write(b);
- btree_node_lock_type(c, b, lock_held);
- }
+ if (b->written &&
+ btree_node_need_write(b) &&
+ btree_node_may_write(b) &&
+ !btree_node_write_in_flight(b))
+ bch2_btree_node_write(c, b, lock_held);
}
#define bch2_btree_node_write_cond(_c, _b, cond) \