diff mbox series

scsi: Don't print target alloc failed print for ENXIO

Message ID 20210726115402.1936-1-sreekanth.reddy@broadcom.com (mailing list archive)
State Accepted
Headers show
Series scsi: Don't print target alloc failed print for ENXIO | expand

Commit Message

Sreekanth Reddy July 26, 2021, 11:54 a.m. UTC
Don't print 'target allocation failed' message if the driver
returns -ENXIO error value for target_alloc callback function.
Driver returns -ENXIO value if corresponding H:C:T:L entry
is empty.

Removing this print reduces the scan time if the user issues
SCAN_WILD_CARD scan operation through sysfs parameter on a host
with a lot of empty H:C:T:L entries.

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
---
 drivers/scsi/scsi_scan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Martin K. Petersen July 29, 2021, 3:37 a.m. UTC | #1
On Mon, 26 Jul 2021 17:24:02 +0530, Sreekanth Reddy wrote:

> Don't print 'target allocation failed' message if the driver
> returns -ENXIO error value for target_alloc callback function.
> Driver returns -ENXIO value if corresponding H:C:T:L entry
> is empty.
> 
> Removing this print reduces the scan time if the user issues
> SCAN_WILD_CARD scan operation through sysfs parameter on a host
> with a lot of empty H:C:T:L entries.

Applied to 5.14/scsi-fixes, thanks!

[1/1] scsi: Don't print target alloc failed print for ENXIO
      https://git.kernel.org/mkp/scsi/c/85601d88eccc
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index b059bf2b61d4..5b6996a2401b 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -475,7 +475,8 @@  static struct scsi_target *scsi_alloc_target(struct device *parent,
 		error = shost->hostt->target_alloc(starget);
 
 		if(error) {
-			dev_printk(KERN_ERR, dev, "target allocation failed, error %d\n", error);
+			if (error != -ENXIO)
+				dev_err(dev, "target allocation failed, error %d\n", error);
 			/* don't want scsi_target_reap to do the final
 			 * put because it will be under the host lock */
 			scsi_target_destroy(starget);