]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
scsi: hisi_sas: define hisi_sas_device.device_id as int
authorJohn Garry <john.garry@huawei.com>
Fri, 4 Aug 2017 19:50:23 +0000 (13:50 -0600)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 9 Aug 2017 14:38:36 +0000 (16:38 +0200)
BugLink: https://bugs.launchpad.net/bugs/1708734
Currently hisi_sas_device.device_id is a u64. This can create a problem
in selecting the queue for a device, in that this code does a 64b
division on device id. For some 32b systems, 64b division is slow and
the lib reference must be explicitly included.

The device id does not need to be 64b in size, so, as a solution, just
make as an int.

Also, struct hisi_sas_device elements are re-ordered to improve packing
efficiency.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit ad6048325c7807818c6c49e485660143d97a622e)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Seth Forshee <seth.forshee@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/scsi/hisi_sas/hisi_sas.h
drivers/scsi/hisi_sas/hisi_sas_main.c

index 4e28f32e90b0a1d43eb5cd150703498b14da951d..b4e96fa90bc281023c2c1651d82f2717628e3b8d 100644 (file)
@@ -107,15 +107,15 @@ struct hisi_sas_dq {
 };
 
 struct hisi_sas_device {
-       enum sas_device_type    dev_type;
        struct hisi_hba         *hisi_hba;
        struct domain_device    *sas_device;
+       struct list_head        list;
        u64 attached_phy;
-       u64 device_id;
        atomic64_t running_req;
-       struct list_head        list;
-       u8 dev_status;
+       enum sas_device_type    dev_type;
+       int device_id;
        int sata_idx;
+       u8 dev_status;
 };
 
 struct hisi_sas_slot {
index 60592a4b65a2e8faf0ecd0381a19c9b94b874251..ac5843c3f5d2f3ef094ac21a85580220e97ef934 100644 (file)
@@ -209,7 +209,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba,
 
        if (DEV_IS_GONE(sas_dev)) {
                if (sas_dev)
-                       dev_info(dev, "task prep: device %llu not ready\n",
+                       dev_info(dev, "task prep: device %d not ready\n",
                                 sas_dev->device_id);
                else
                        dev_info(dev, "task prep: device %016llx not ready\n",
@@ -627,9 +627,9 @@ static void hisi_sas_dev_gone(struct domain_device *device)
        struct hisi_sas_device *sas_dev = device->lldd_dev;
        struct hisi_hba *hisi_hba = dev_to_hisi_hba(device);
        struct device *dev = &hisi_hba->pdev->dev;
-       u64 dev_id = sas_dev->device_id;
+       int dev_id = sas_dev->device_id;
 
-       dev_info(dev, "found dev[%lld:%x] is gone\n",
+       dev_info(dev, "found dev[%d:%x] is gone\n",
                 sas_dev->device_id, sas_dev->dev_type);
 
        hisi_sas_internal_task_abort(hisi_hba, device,
@@ -1082,7 +1082,7 @@ static int hisi_sas_lu_reset(struct domain_device *device, u8 *lun)
        }
 out:
        if (rc != TMF_RESP_FUNC_COMPLETE)
-               dev_err(dev, "lu_reset: for device[%llx]:rc= %d\n",
+               dev_err(dev, "lu_reset: for device[%d]:rc= %d\n",
                             sas_dev->device_id, rc);
        return rc;
 }
@@ -1129,7 +1129,7 @@ static int hisi_sas_query_task(struct sas_task *task)
 }
 
 static int
-hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, u64 device_id,
+hisi_sas_internal_abort_task_exec(struct hisi_hba *hisi_hba, int device_id,
                                  struct sas_task *task, int abort_flag,
                                  int task_tag)
 {