Skip to content

Commit a887f20

Browse files
committed
bcache: Move journal work to new background wq
This is potentially long running and not latency sensitive, let's get it out of the way of other latency sensitive events.
1 parent 5ac8cf2 commit a887f20

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

drivers/md/bcache/bcache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ void bch_write_bdev_super(struct cached_dev *dc, struct closure *parent);
10041004

10051005
extern struct workqueue_struct *bcache_wq;
10061006
extern struct workqueue_struct *bch_journal_wq;
1007+
extern struct workqueue_struct *bch_background_wq;
10071008
extern struct mutex bch_register_lock;
10081009
extern struct list_head bch_cache_sets;
10091010

drivers/md/bcache/journal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,8 @@ atomic_t *bch_journal(struct cache_set *c,
932932
journal_try_write(c);
933933
} else if (!w->dirty) {
934934
w->dirty = true;
935-
schedule_delayed_work(&c->journal.work,
936-
msecs_to_jiffies(c->journal_delay_ms));
935+
queue_delayed_work(bch_background_wq, &c->journal.work,
936+
msecs_to_jiffies(c->journal_delay_ms));
937937
spin_unlock(&c->journal.lock);
938938
} else {
939939
spin_unlock(&c->journal.lock);

drivers/md/bcache/super.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ static int bcache_major;
4949
static DEFINE_IDA(bcache_device_idx);
5050
static wait_queue_head_t unregister_wait;
5151
struct workqueue_struct *bcache_wq;
52+
struct workqueue_struct *bch_background_wq;
5253
struct workqueue_struct *bch_journal_wq;
5354

5455

@@ -2789,6 +2790,8 @@ static void bcache_exit(void)
27892790
destroy_workqueue(bcache_wq);
27902791
if (bch_journal_wq)
27912792
destroy_workqueue(bch_journal_wq);
2793+
if (bch_background_wq)
2794+
destroy_workqueue(bch_background_wq);
27922795

27932796
if (bcache_major)
27942797
unregister_blkdev(bcache_major, "bcache");
@@ -2851,6 +2854,10 @@ static int __init bcache_init(void)
28512854
if (bch_btree_init())
28522855
goto err;
28532856

2857+
bch_background_wq = alloc_workqueue("bch_background", 0, 0);
2858+
if (!bch_background_wq)
2859+
goto err;
2860+
28542861
bch_journal_wq = alloc_workqueue("bch_journal", WQ_MEM_RECLAIM, 0);
28552862
if (!bch_journal_wq)
28562863
goto err;

0 commit comments

Comments
 (0)