Skip to contentSkip to conversation

scsi: remove reduntant assignment when alloc sdev

PATCH In review Ed Tsai 2 participants 4 messages Jun 21, 2021 – Jun 22, 2021 SCSI

lore
Share & tools
lore

Ed Tsai

author
#0 lore raw

PATCH 1/1 scsi: remove reduntant assignment when alloc sdev

sdev->reqeust_queue and its queuedata have been set up in scsi_mq_alloc_queue(). No need to do that again.

---
 drivers/scsi/scsi_scan.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/scsi_scan.c +1 -3
index 12f54571b83e..82c1792f1de2 100644
@@ -266,8 +266,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 	 */
 	sdev->borken = 1;
 
-	sdev->request_queue = scsi_mq_alloc_queue(sdev);
-	if (!sdev->request_queue) {
+	if (!scsi_mq_alloc_queue(sdev)) {
 		/* release fn is set up in scsi_sysfs_device_initialise, so
 		 * have to free and put manually here */
 		put_device(&starget->dev);
@@ -275,7 +274,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 		goto out;
 	}
 	WARN_ON_ONCE(!blk_get_queue(sdev->request_queue));
-	sdev->request_queue->queuedata = sdev;
 
 	depth = sdev->host->cmd_per_lun ?: 1;
 
Signature · 1 line
2.18.0
#1 lore raw
Quoted 23 lines · Ed Tsai

sdev->reqeust_queue and its queuedata have been set up in scsi_mq_alloc_queue(). No need to do that again.

---
 drivers/scsi/scsi_scan.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/scsi_scan.c +1 -2
index 12f54571b83e..82c1792f1de2 100644
@@ -266,8 +266,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 	 */
 	sdev->borken = 1;
 
-	sdev->request_queue = scsi_mq_alloc_queue(sdev);
-	if (!sdev->request_queue) {
+	if (!scsi_mq_alloc_queue(sdev)) {
 		/* release fn is set up in scsi_sysfs_device_initialise, so
 		 * have to free and put manually here */
 		put_device(&starget->dev);

drivers/scsi/scsi_scan.c static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, · line 278

Quoted 6 lines
drivers/scsi/scsi_scan.c +0 -1
@@ -275,7 +274,6 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
 		goto out;
 	}
 	WARN_ON_ONCE(!blk_get_queue(sdev->request_queue));
-	sdev->request_queue->queuedata = sdev;
 
 	depth = sdev->host->cmd_per_lun ?: 1;

Since scsi_mq_alloc_queue() only has one caller, please inline scsi_mq_alloc_queue() instead of making this change. See also
https://lore.kernel.org/linux-scsi/[email protected]/

Thanks,

Bart.

author
#2 lore raw
Quoted 32 lines · Bart Van Assche
Quoted 31 lines · Ed Tsai

sdev->reqeust_queue and its queuedata have been set up in scsi_mq_alloc_queue(). No need to do that again.

---
 drivers/scsi/scsi_scan.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/scsi/scsi_scan.c +1 -2
index 12f54571b83e..82c1792f1de2 100644
@@ -266,8 +266,7 @@ static struct scsi_device
 *scsi_alloc_sdev(struct scsi_target *starget,
 	 */
 	sdev->borken = 1;
 
-	sdev->request_queue = scsi_mq_alloc_queue(sdev);
-	if (!sdev->request_queue) {
+	if (!scsi_mq_alloc_queue(sdev)) {
 		/* release fn is set up in

scsi_sysfs_device_initialise, so

drivers/scsi/scsi_scan.c +0 -1
 		 * have to free and put manually here */
 		put_device(&starget->dev);
@@ -275,7 +274,6 @@ static struct scsi_device
 *scsi_alloc_sdev(struct scsi_target *starget,
 		goto out;
 	}
 	WARN_ON_ONCE(!blk_get_queue(sdev->request_queue));
-	sdev->request_queue->queuedata = sdev;
 
Quoted 5 lines

drivers/scsi/scsi_scan.c static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget, · line 278

Quoted 1 line
drivers/scsi/scsi_scan.c +0 -0
 	depth = sdev->host->cmd_per_lun ?: 1;

Since scsi_mq_alloc_queue() only has one caller, please inline scsi_mq_alloc_queue() instead of making this change. See also

https://lore.kernel.org/linux-scsi/[email protected]/

Quoted 4 lines

Thanks,

Bart.

have planned to re-submit it?

#3 lore raw
Quoted 1 line · Ed Tsai

have planned to re-submit it?

That patch has just been resubmitted. I have Cc-ed you.

Thanks,

Bart.