diff options
author | Joe Thornber <ejt@redhat.com> | 2023-03-22 14:34:49 +0100 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2023-03-30 21:57:50 +0200 |
commit | bb46c56165faf284cf42c197317bff24f899835a (patch) | |
tree | 39d349a5cc58710b48f8e40f0efabeb86fac3683 /drivers/md | |
parent | dm bufio: use multi-page bio vector (diff) | |
download | linux-bb46c56165faf284cf42c197317bff24f899835a.tar.xz linux-bb46c56165faf284cf42c197317bff24f899835a.zip |
dm thin: speed up cell_defer_no_holder()
Reduce the time that a spinlock is held in cell_defer_no_holder().
Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-thin.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 13d4677baafd..00323428919e 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -883,15 +883,17 @@ static void cell_defer_no_holder(struct thin_c *tc, struct dm_bio_prison_cell *c { struct pool *pool = tc->pool; unsigned long flags; - int has_work; + struct bio_list bios; - spin_lock_irqsave(&tc->lock, flags); - cell_release_no_holder(pool, cell, &tc->deferred_bio_list); - has_work = !bio_list_empty(&tc->deferred_bio_list); - spin_unlock_irqrestore(&tc->lock, flags); + bio_list_init(&bios); + cell_release_no_holder(pool, cell, &bios); - if (has_work) + if (!bio_list_empty(&bios)) { + spin_lock_irqsave(&tc->lock, flags); + bio_list_merge(&tc->deferred_bio_list, &bios); + spin_unlock_irqrestore(&tc->lock, flags); wake_worker(pool); + } } static void thin_defer_bio(struct thin_c *tc, struct bio *bio); |