hpsa: eliminate fake lun0 enclosures
authorScott Teel <scott.teel@pmcs.com>
Wed, 4 Nov 2015 21:52:03 +0000 (15:52 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Mon, 9 Nov 2015 17:39:26 +0000 (12:39 -0500)
We don't need to create fake enclosure devices at Lun0
in external target array configurations anymore.
This was done to support Pre-SCSI rev 5 controllers
that didn't suppoprt report luns commands, so the
SCSI layer had to scan targets. If there was no
LUN at LUN 0, then the target scan would stop, and
move to the next target.  Lun0 enclosure device
was added to prevent sparsely-numbered LUNs from
being missed.

Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hpsa.c

index 1a67d63d5585e99321d2a92a31b775b61390ef81..c843dd288a4e565dff12db504be25c747c9d9eb2 100644 (file)
@@ -3571,60 +3571,6 @@ static void figure_bus_target_lun(struct ctlr_info *h,
                                0, lunid & 0x3fff);
 }
 
-/*
- * If there is no lun 0 on a target, linux won't find any devices.
- * For the external targets (arrays), we have to manually detect the enclosure
- * which is at lun zero, as CCISS_REPORT_PHYSICAL_LUNS doesn't report
- * it for some reason.  *tmpdevice is the target we're adding,
- * this_device is a pointer into the current element of currentsd[]
- * that we're building up in update_scsi_devices(), below.
- * lunzerobits is a bitmap that tracks which targets already have a
- * lun 0 assigned.
- * Returns 1 if an enclosure was added, 0 if not.
- */
-static int add_ext_target_dev(struct ctlr_info *h,
-       struct hpsa_scsi_dev_t *tmpdevice,
-       struct hpsa_scsi_dev_t *this_device, u8 *lunaddrbytes,
-       unsigned long lunzerobits[], int *n_ext_target_devs)
-{
-       unsigned char scsi3addr[8];
-
-       if (test_bit(tmpdevice->target, lunzerobits))
-               return 0; /* There is already a lun 0 on this target. */
-
-       if (!is_logical_dev_addr_mode(lunaddrbytes))
-               return 0; /* It's the logical targets that may lack lun 0. */
-
-       if (!tmpdevice->external)
-               return 0; /* Only external target devices have this problem. */
-
-       if (tmpdevice->lun == 0) /* if lun is 0, then we have a lun 0. */
-               return 0;
-
-       memset(scsi3addr, 0, 8);
-       scsi3addr[3] = tmpdevice->target;
-       if (is_hba_lunid(scsi3addr))
-               return 0; /* Don't add the RAID controller here. */
-
-       if (is_scsi_rev_5(h))
-               return 0; /* p1210m doesn't need to do this. */
-
-       if (*n_ext_target_devs >= MAX_EXT_TARGETS) {
-               dev_warn(&h->pdev->dev, "Maximum number of external "
-                       "target devices exceeded.  Check your hardware "
-                       "configuration.");
-               return 0;
-       }
-
-       if (hpsa_update_device_info(h, scsi3addr, this_device, NULL))
-               return 0;
-       (*n_ext_target_devs)++;
-       hpsa_set_bus_target_lun(this_device,
-                               tmpdevice->bus, tmpdevice->target, 0);
-       hpsa_update_device_supports_aborts(h, this_device, scsi3addr);
-       set_bit(tmpdevice->target, lunzerobits);
-       return 1;
-}
 
 /*
  * Get address of physical disk used for an ioaccel2 mode command:
@@ -3952,20 +3898,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h)
                hpsa_update_device_supports_aborts(h, tmpdevice, lunaddrbytes);
                this_device = currentsd[ncurrent];
 
-               /*
-                * For external target devices, we have to insert a LUN 0 which
-                * doesn't show up in CCISS_REPORT_PHYSICAL data, but there
-                * is nonetheless an enclosure device there.  We have to
-                * present that otherwise linux won't find anything if
-                * there is no lun 0.
-                */
-               if (add_ext_target_dev(h, tmpdevice, this_device,
-                               lunaddrbytes, lunzerobits,
-                               &n_ext_target_devs)) {
-                       ncurrent++;
-                       this_device = currentsd[ncurrent];
-               }
-
                *this_device = *tmpdevice;
                this_device->physical_device = physical_device;