On 11/18/19 11:31 AM, Ming Lei wrote: > 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 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> > Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> > --- > drivers/scsi/sd.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c > index 03163ac5fe95..0744c34468e1 100644 > --- a/drivers/scsi/sd.c > +++ b/drivers/scsi/sd.c > @@ -3368,12 +3368,14 @@ static int sd_probe(struct device *dev) > } > > blk_pm_runtime_init(sdp->request_queue, dev); > - 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); > if (sdkp->opal_dev) > Reviewed-by: Hannes Reinecke <hare@xxxxxxx> Cheers, Hannes -- Dr. Hannes Reinecke Teamlead Storage & Networking hare@xxxxxxx +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 247165 (AG München), GF: Felix Imendörffer