public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: "longguang.yue" <bigclouds@163.com>
To: jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, "longguang.yue" <bigclouds@163.com>
Subject: [PATCH] Add a parameter to set sd driver's probe mode.
Date: Tue, 25 Apr 2023 15:59:48 +0800	[thread overview]
Message-ID: <20230425075948.87632-1-bigclouds@163.com> (raw)

Asynchronous probe leads to the change of disk name, so it is hard
to trace disk by its name for monitoring system.

Signed-off-by: longguang.yue <bigclouds@163.com>
---
 drivers/scsi/sd.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 4bb87043e6db..ea0ac8823599 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -99,6 +99,11 @@ MODULE_ALIAS_SCSI_DEVICE(TYPE_ZBC);
 
 #define SD_MINORS	16
 
+static unsigned int async = PROBE_PREFER_ASYNCHRONOUS;
+module_param(async, uint, 0644);
+MODULE_PARM_DESC(async,
+		 "probe scsi disk asynchronously or not. Default is 1 asynchronous.");
+
 static void sd_config_discard(struct scsi_disk *, unsigned int);
 static void sd_config_write_same(struct scsi_disk *);
 static int  sd_revalidate_disk(struct gendisk *);
@@ -3839,6 +3844,9 @@ static int __init init_sd(void)
 
 	SCSI_LOG_HLQUEUE(3, printk("init_sd: sd driver entry point\n"));
 
+	if (async != PROBE_PREFER_ASYNCHRONOUS)
+		sd_template.gendrv.probe_type = PROBE_FORCE_SYNCHRONOUS;
+
 	for (i = 0; i < SD_MAJORS; i++) {
 		if (__register_blkdev(sd_major(i), "sd", sd_default_probe))
 			continue;
-- 
2.34.1


             reply	other threads:[~2023-04-25  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-25  7:59 longguang.yue [this message]
2023-04-25 12:19 ` [PATCH] Add a parameter to set sd driver's probe mode James Bottomley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230425075948.87632-1-bigclouds@163.com \
    --to=bigclouds@163.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox