]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
target: pscsi: Introduce TYPE_ZBC support
authorDamien Le Moal <damien.lemoal@wdc.com>
Wed, 28 Jun 2017 05:58:57 +0000 (14:58 +0900)
committerNicholas Bellinger <nab@linux-iscsi.org>
Fri, 7 Jul 2017 06:11:49 +0000 (23:11 -0700)
TYPE_ZBC host managed zoned block devices are also block devices
despite the non-standard device type (14h). Handle them similarly to
regular TYPE_DISK devices.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_pscsi.c

index fb40f64072f6bfc5ef74d58bdbdf05944f47f782..b71d22ebc9bfb16b097183c40a3bbfca7f91343f 100644 (file)
@@ -382,7 +382,7 @@ static int pscsi_create_type_disk(struct se_device *dev, struct scsi_device *sd)
        spin_unlock_irq(sh->host_lock);
        /*
         * Claim exclusive struct block_device access to struct scsi_device
        spin_unlock_irq(sh->host_lock);
        /*
         * Claim exclusive struct block_device access to struct scsi_device
-        * for TYPE_DISK using supplied udev_path
+        * for TYPE_DISK and TYPE_ZBC using supplied udev_path
         */
        bd = blkdev_get_by_path(dev->udev_path,
                                FMODE_WRITE|FMODE_READ|FMODE_EXCL, pdv);
         */
        bd = blkdev_get_by_path(dev->udev_path,
                                FMODE_WRITE|FMODE_READ|FMODE_EXCL, pdv);
@@ -400,8 +400,9 @@ static int pscsi_create_type_disk(struct se_device *dev, struct scsi_device *sd)
                return ret;
        }
 
                return ret;
        }
 
-       pr_debug("CORE_PSCSI[%d] - Added TYPE_DISK for %d:%d:%d:%llu\n",
-               phv->phv_host_id, sh->host_no, sd->channel, sd->id, sd->lun);
+       pr_debug("CORE_PSCSI[%d] - Added TYPE_%s for %d:%d:%d:%llu\n",
+               phv->phv_host_id, sd->type == TYPE_DISK ? "DISK" : "ZBC",
+               sh->host_no, sd->channel, sd->id, sd->lun);
        return 0;
 }
 
        return 0;
 }
 
@@ -520,6 +521,7 @@ static int pscsi_configure_device(struct se_device *dev)
                 */
                switch (sd->type) {
                case TYPE_DISK:
                 */
                switch (sd->type) {
                case TYPE_DISK:
+               case TYPE_ZBC:
                        ret = pscsi_create_type_disk(dev, sd);
                        break;
                default:
                        ret = pscsi_create_type_disk(dev, sd);
                        break;
                default:
@@ -576,9 +578,11 @@ static void pscsi_destroy_device(struct se_device *dev)
        if (sd) {
                /*
                 * Release exclusive pSCSI internal struct block_device claim for
        if (sd) {
                /*
                 * Release exclusive pSCSI internal struct block_device claim for
-                * struct scsi_device with TYPE_DISK from pscsi_create_type_disk()
+                * struct scsi_device with TYPE_DISK or TYPE_ZBC
+                * from pscsi_create_type_disk()
                 */
                 */
-               if ((sd->type == TYPE_DISK) && pdv->pdv_bd) {
+               if ((sd->type == TYPE_DISK || sd->type == TYPE_ZBC) &&
+                   pdv->pdv_bd) {
                        blkdev_put(pdv->pdv_bd,
                                   FMODE_WRITE|FMODE_READ|FMODE_EXCL);
                        pdv->pdv_bd = NULL;
                        blkdev_put(pdv->pdv_bd,
                                   FMODE_WRITE|FMODE_READ|FMODE_EXCL);
                        pdv->pdv_bd = NULL;
@@ -1000,7 +1004,8 @@ pscsi_execute_cmd(struct se_cmd *cmd)
        req->end_io_data = cmd;
        scsi_req(req)->cmd_len = scsi_command_size(pt->pscsi_cdb);
        scsi_req(req)->cmd = &pt->pscsi_cdb[0];
        req->end_io_data = cmd;
        scsi_req(req)->cmd_len = scsi_command_size(pt->pscsi_cdb);
        scsi_req(req)->cmd = &pt->pscsi_cdb[0];
-       if (pdv->pdv_sd->type == TYPE_DISK)
+       if (pdv->pdv_sd->type == TYPE_DISK ||
+           pdv->pdv_sd->type == TYPE_ZBC)
                req->timeout = PS_TIMEOUT_DISK;
        else
                req->timeout = PS_TIMEOUT_OTHER;
                req->timeout = PS_TIMEOUT_DISK;
        else
                req->timeout = PS_TIMEOUT_OTHER;