bcachefs: Split out btree_error_wq

We can't use btree_update_wq becuase btree updates may be waiting on
btree writes to complete.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2021-05-27 21:38:00 -04:00 committed by Kent Overstreet
parent bff796ae65
commit 9f2772c454
3 changed files with 6 additions and 1 deletions

View file

@ -667,6 +667,7 @@ struct bch_fs {
struct btree_key_cache btree_key_cache;
struct workqueue_struct *btree_update_wq;
struct workqueue_struct *btree_error_wq;
/* copygc needs its own workqueue for index updates.. */
struct workqueue_struct *copygc_wq;

View file

@ -1618,7 +1618,7 @@ static void btree_node_write_work(struct work_struct *work)
bio_list_add(&c->btree_write_error_list, &wbio->wbio.bio);
spin_unlock_irqrestore(&c->btree_write_error_lock, flags);
queue_work(c->btree_update_wq, &c->btree_write_error_work);
queue_work(c->btree_error_wq, &c->btree_write_error_work);
return;
}

View file

@ -514,6 +514,8 @@ static void __bch2_fs_free(struct bch_fs *c)
destroy_workqueue(c->io_complete_wq );
if (c->copygc_wq)
destroy_workqueue(c->copygc_wq);
if (c->btree_error_wq)
destroy_workqueue(c->btree_error_wq);
if (c->btree_update_wq)
destroy_workqueue(c->btree_update_wq);
@ -766,6 +768,8 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
if (!(c->btree_update_wq = alloc_workqueue("bcachefs",
WQ_FREEZABLE|WQ_MEM_RECLAIM, 1)) ||
!(c->btree_error_wq = alloc_workqueue("bcachefs_error",
WQ_FREEZABLE|WQ_MEM_RECLAIM, 1)) ||
!(c->copygc_wq = alloc_workqueue("bcachefs_copygc",
WQ_FREEZABLE|WQ_MEM_RECLAIM|WQ_CPU_INTENSIVE, 1)) ||
!(c->io_complete_wq = alloc_workqueue("bcachefs_io",