dm thin: Remove unnecessary locking from pool_map()

pool_map() takes pool->lock only while setting the bio's data device.

The pool target's data_dev is initialized when the target is
constructed and is not changed afterwards.  The device-mapper target
remains alive while its map callback is running, so pool->lock is not
needed to protect data_dev.

Remove the unnecessary locking.  This also avoids holding pool->lock
across bio_set_dev(), which may perform a blkcg lookup and acquire the
request queue's queue_lock.

Signed-off-by: Hao Zhang <zhanghao1@kylinos.cn>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
This commit is contained in:
Hao Zhang 2026-09-12 00:07:33 +08:00 committed by Mikulas Patocka
parent bec2fa7bdf
commit 99909b74fb

View File

@ -3438,14 +3438,11 @@ static int pool_ctr(struct dm_target *ti, unsigned int argc, char **argv)
static int pool_map(struct dm_target *ti, struct bio *bio)
{
struct pool_c *pt = ti->private;
struct pool *pool = pt->pool;
/*
* As this is a singleton target, ti->begin is always zero.
*/
spin_lock_irq(&pool->lock);
bio_set_dev(bio, pt->data_dev->bdev);
spin_unlock_irq(&pool->lock);
return DM_MAPIO_REMAPPED;
}