]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Allow LLDD's to fail slave alloc (non-existent slave)
authorJames Smart <james.smart@emulex.com>
Mon, 20 Sep 2004 17:24:08 +0000 (13:24 -0400)
committerChristoph Hellwig <hch@lst.de>
Mon, 20 Sep 2004 17:24:08 +0000 (13:24 -0400)
In the cases where an LLDD knows that a lun does not exist, if it
fails slave_alloc(), the midlayer reports an error message indicating
slave_alloc failed.

This patch allows the LLDD to reject the slave_alloc() call if it
knows the lun doesn't exist, and skips the reporting of the
slave_alloc failure message. This avoids jumping through hoops in the
LLDD to avoid error messages from slave_alloc. Also saves cycles in
that the probe is also cancelled for the non-existent device.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/scsi_scan.c

index 4ad924dbb110a5b3c312e32a1a87bacbe78c8aa8..d85bf359c2b04750f6a2e39c7024a7f9ed1ed4c2 100644 (file)
@@ -204,6 +204,7 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
 {
        struct scsi_device *sdev, *device;
        unsigned long flags;
+       int display_failure_msg = 1, ret;
 
        sdev = kmalloc(sizeof(*sdev) + shost->transportt->size, GFP_ATOMIC);
        if (!sdev)
@@ -252,8 +253,16 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
        scsi_adjust_queue_depth(sdev, 0, sdev->host->cmd_per_lun);
 
        if (shost->hostt->slave_alloc) {
-               if (shost->hostt->slave_alloc(sdev))
+               ret = shost->hostt->slave_alloc(sdev);
+               if (ret) {
+                       /*
+                        * if LLDD reports slave not present, don't clutter
+                        * console with alloc failure messages
+                        */
+                       if (ret == -ENXIO)
+                               display_failure_msg = 0;
                        goto out_free_queue;
+               }
        }
 
        if (shost->transportt->setup) {
@@ -325,7 +334,8 @@ out_free_queue:
 out_free_dev:
        kfree(sdev);
 out:
-       printk(ALLOC_FAILURE_MSG, __FUNCTION__);
+       if (display_failure_msg)
+               printk(ALLOC_FAILURE_MSG, __FUNCTION__);
        return NULL;
 }