Skip to contentSkip to conversation

Reduce number of scsi_test_unit_ready() retries

PATCH Applied Bart Van Assche 3 participants 3 messages Feb 12, 2018 – Feb 14, 2018 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Reduce number of scsi_test_unit_ready() retries

Make scsi_test_unit_ready() send at most as many TURs as specified in the 'retries' argument instead of retries * (retries + 1) / 2.

---
 drivers/scsi/scsi_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +1 -1
index b03cb2d5b733..9c793090dbf1 100644
@@ -2607,7 +2607,7 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries,
 	/* try to eat the UNIT_ATTENTION if there are enough retries */
 	do {
 		result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr,
-					  timeout, retries, NULL);
+					  timeout, 1, NULL);
 		if (sdev->removable && scsi_sense_valid(sshdr) &&
 		    sshdr->sense_key == UNIT_ATTENTION)
 			sdev->changed = 1;
Signature · 1 line
2.16.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 14 lines · Bart Van Assche

Make scsi_test_unit_ready() send at most as many TURs as specified in the 'retries' argument instead of retries * (retries + 1) / 2.

---
 drivers/scsi/scsi_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +0 -0
index b03cb2d5b733..9c793090dbf1 100644

drivers/scsi/scsi_lib.c scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries, · line 2613

Quoted 8 lines
drivers/scsi/scsi_lib.c +1 -1
@@ -2607,7 +2607,7 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries,
 	/* try to eat the UNIT_ATTENTION if there are enough retries */
 	do {
 		result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr,
-					  timeout, retries, NULL);
+					  timeout, 1, NULL);
 		if (sdev->removable && scsi_sense_valid(sshdr) &&
 		    sshdr->sense_key == UNIT_ATTENTION)
 			sdev->changed = 1;

At one point we _really_ need to clean up BLOCK_PC command handling. This 'some parts are handled by the core, some parts need to be evaluated by the caller' magic is driving my nuts :-( Anyway.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#2 lore raw
In reply to Bart Van Assche

Bart,

Quoted 2 lines

Make scsi_test_unit_ready() send at most as many TURs as specified in the 'retries' argument instead of retries * (retries + 1) / 2.

Applied to 4.17/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering