scsi: sr: get rid of sr global mutex
authorMerlijn Wajer <merlijn@archive.org>
Tue, 18 Feb 2020 14:39:17 +0000 (15:39 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 24 Feb 2020 20:01:57 +0000 (15:01 -0500)
commit51a858817dcdbbdee22cb54b0b2b26eb145ca5b6
tree2ca71f96adf0db09c1a7f184fe6f17a8cfb9d367
parent679b2ec8e060ca7a90441aff5e7d384720a41b76
scsi: sr: get rid of sr global mutex

When replacing the Big Kernel Lock in commit 2a48fc0ab242 ("block:
autoconvert trivial BKL users to private mutex"), the lock was replaced
with a sr-wide lock.

This causes very poor performance when using multiple sr devices, as the sr
driver was not able to execute more than one command to one drive at any
given time, even when there were many CD drives available.

Replace the global mutex with per-sr-device mutex.

Someone tried this patch at the time, but it never made it upstream, due to
possible concerns with race conditions, but it's not clear the patch
actually caused those:

https://www.spinics.net/lists/linux-scsi/msg63706.html
https://www.spinics.net/lists/linux-scsi/msg63750.html

Also see

http://lists.xiph.org/pipermail/paranoia/2019-December/001647.html

Link: https://lore.kernel.org/r/20200218143918.30267-1-merlijn@archive.org
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Merlijn Wajer <merlijn@archive.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sr.c
drivers/scsi/sr.h