summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sr.h
diff options
context:
space:
mode:
authorMerlijn Wajer <merlijn@archive.org>2020-02-18 15:39:17 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2020-02-24 15:01:57 -0500
commit51a858817dcdbbdee22cb54b0b2b26eb145ca5b6 (patch)
tree2ca71f96adf0db09c1a7f184fe6f17a8cfb9d367 /drivers/scsi/sr.h
parent679b2ec8e060ca7a90441aff5e7d384720a41b76 (diff)
downloadlinux-51a858817dcdbbdee22cb54b0b2b26eb145ca5b6.tar.bz2
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>
Diffstat (limited to 'drivers/scsi/sr.h')
-rw-r--r--drivers/scsi/sr.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/scsi/sr.h b/drivers/scsi/sr.h
index a2bb7b8bace5..339c624e04d8 100644
--- a/drivers/scsi/sr.h
+++ b/drivers/scsi/sr.h
@@ -20,6 +20,7 @@
#include <linux/genhd.h>
#include <linux/kref.h>
+#include <linux/mutex.h>
#define MAX_RETRIES 3
#define SR_TIMEOUT (30 * HZ)
@@ -51,6 +52,7 @@ typedef struct scsi_cd {
bool ignore_get_event:1; /* GET_EVENT is unreliable, use TUR */
struct cdrom_device_info cdi;
+ struct mutex lock;
/* We hold gendisk and scsi_device references on probe and use
* the refs on this kref to decide when to release them */
struct kref kref;