]> git.baikalelectronics.ru Git - kernel.git/commit
loop: scale loop device by introducing per device lock
authorPavel Tatashin <pasha.tatashin@soleen.com>
Tue, 26 Jan 2021 14:46:30 +0000 (09:46 -0500)
committerJens Axboe <axboe@kernel.dk>
Tue, 26 Jan 2021 20:08:54 +0000 (13:08 -0700)
commitabf89ca29abd427df15f63f5d5394673fe124392
tree56cd7cc2a0396ec04459122368b05771873e8b77
parent0556ab35ebc2f06a7a89380ad2cbc1ece582141b
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>
drivers/block/loop.c
drivers/block/loop.h