Commit bb46c561 authored by Joe Thornber's avatar Joe Thornber Committed by Mike Snitzer
Browse files

dm thin: speed up cell_defer_no_holder()



Reduce the time that a spinlock is held in cell_defer_no_holder().

Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@kernel.org>
parent 56c5de44
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -883,16 +883,18 @@ 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;

	bio_list_init(&bios);
	cell_release_no_holder(pool, cell, &bios);

	if (!bio_list_empty(&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);
		bio_list_merge(&tc->deferred_bio_list, &bios);
		spin_unlock_irqrestore(&tc->lock, flags);

	if (has_work)
		wake_worker(pool);
	}
}

static void thin_defer_bio(struct thin_c *tc, struct bio *bio);