diff options
author | Pavel Tatashin <pasha.tatashin@soleen.com> | 2021-01-26 15:46:30 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-01-26 21:08:54 +0100 |
commit | 6cc8e7430801fa238bd7d3acae1eb406c6e02fe1 (patch) | |
tree | 56cd7cc2a0396ec04459122368b05771873e8b77 /drivers/block/loop.h | |
parent | bdev: Do not return EBUSY if bdev discard races with write (diff) | |
download | linux-6cc8e7430801fa238bd7d3acae1eb406c6e02fe1.tar.xz linux-6cc8e7430801fa238bd7d3acae1eb406c6e02fe1.zip |
loop: scale loop device by introducing per device lock
Currently, loop device has only one global lock: loop_ctl_mutex.
This becomes hot in scenarios where many loop devices are used.
Scale it by introducing per-device lock: lo_mutex that protects
modifications of all fields in struct loop_device.
Keep loop_ctl_mutex to protect global data: loop_index_idr, loop_lookup,
loop_add.
The new lock ordering requirement is that loop_ctl_mutex must be taken
before lo_mutex.
Signed-off-by: Pavel Tatashin <pasha.tatashin@soleen.com>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r-- | drivers/block/loop.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/block/loop.h b/drivers/block/loop.h index af75a5ee4094..a3c04f310672 100644 --- a/drivers/block/loop.h +++ b/drivers/block/loop.h @@ -62,6 +62,7 @@ struct loop_device { struct request_queue *lo_queue; struct blk_mq_tag_set tag_set; struct gendisk *lo_disk; + struct mutex lo_mutex; }; struct loop_cmd { |