Prepare for improving SSD performance in the following patch, which needs to read queue flag of QUEUE_FLAG_NONROT in IO path. So we have to freeze queue before changing this flag in sd_revalidate_disk(). However, queue freezing becomes quite slow after the queue is registered because RCU grace period is involved. So delay registering queue after sd_revalidate_disk() is done for avoiding slow queue freezing which will be added to sd_revalidate_disk() in the following patch. Cc: Sathya Prakash <sathya.prakash@xxxxxxxxxxxx> Cc: Chaitra P B <chaitra.basappa@xxxxxxxxxxxx> Cc: Suganath Prabu Subramani <suganath-prabu.subramani@xxxxxxxxxxxx> Cc: Kashyap Desai <kashyap.desai@xxxxxxxxxxxx> Cc: Sumit Saxena <sumit.saxena@xxxxxxxxxxxx> Cc: Shivasharan S <shivasharan.srikanteshwara@xxxxxxxxxxxx> Cc: Ewan D. Milne <emilne@xxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx>, Cc: Hannes Reinecke <hare@xxxxxxx> Cc: Bart Van Assche <bart.vanassche@xxxxxxx> Reviewed-by: Hannes Reinecke <hare@xxxxxxx> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> --- drivers/scsi/sd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 5afb0046b12a..f401ba96dcfd 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3380,11 +3380,12 @@ static int sd_probe(struct device *dev) pm_runtime_set_autosuspend_delay(dev, sdp->host->hostt->rpm_autosuspend_delay); } - device_add_disk(dev, gd, NULL); + device_add_disk_no_queue_reg(dev, gd); if (sdkp->capacity) sd_dif_config_host(sdkp); sd_revalidate_disk(gd); + blk_register_queue(gd); if (sdkp->security) { sdkp->opal_dev = init_opal_dev(sdp, &sd_sec_submit); -- 2.20.1