All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@wdc.com>
To: target-devel@vger.kernel.org, linux-scsi@vger.kernel.org,
	"Nicholas A . Bellinger" <nab@linux-iscsi.org>
Cc: "Martin K . Petersen" <martin.petersen@oracle.com>,
	Hannes Reinecke <hare@suse.de>,
	Bart Van Assche <bart.vanassche@sandisk.com>
Subject: [PATCH 2/5] target: pscsi: Introduce TYPE_ZBC support
Date: Wed, 28 Jun 2017 14:58:57 +0900	[thread overview]
Message-ID: <20170628055900.22889-3-damien.lemoal@wdc.com> (raw)
In-Reply-To: <20170628055900.22889-1-damien.lemoal@wdc.com>

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>
---
 drivers/target/target_core_pscsi.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c
index 3e4abb1..97d0318 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -384,7 +384,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
-	 * 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);
@@ -402,8 +402,9 @@ static int pscsi_create_type_disk(struct se_device *dev, struct scsi_device *sd)
 		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;
 }
 
@@ -522,6 +523,7 @@ static int pscsi_configure_device(struct se_device *dev)
 		 */
 		switch (sd->type) {
 		case TYPE_DISK:
+		case TYPE_ZBC:
 			ret = pscsi_create_type_disk(dev, sd);
 			break;
 		default:
@@ -573,9 +575,11 @@ static void pscsi_free_device(struct se_device *dev)
 	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;
@@ -1004,7 +1008,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];
-	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;
-- 
2.9.4

  parent reply	other threads:[~2017-06-28  5:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28  5:58 [PATCH 0/5] target: Zoned block device support and bug fixes Damien Le Moal
2017-06-28  5:58 ` [PATCH 1/5] target: Use macro for WRITE_VERIFY_xx operation codes Damien Le Moal
2017-07-07  5:00   ` Nicholas A. Bellinger
2017-06-28  5:58 ` Damien Le Moal [this message]
2017-07-07  5:00   ` [PATCH 2/5] target: pscsi: Introduce TYPE_ZBC support Nicholas A. Bellinger
2017-06-28  5:58 ` [PATCH 3/5] target: pscsi: Fix sense data handling Damien Le Moal
2017-07-07  5:02   ` Nicholas A. Bellinger
2017-06-28  5:58 ` [PATCH 4/5] target: user: " Damien Le Moal
2017-06-28 17:44   ` Mike Christie
2017-06-29  2:26     ` Damien Le Moal
2017-07-07  4:50     ` Nicholas A. Bellinger
2017-07-07  5:14       ` Damien Le Moal
2017-07-07  6:05         ` Nicholas A. Bellinger
2017-07-07  6:06           ` Nicholas A. Bellinger
2017-07-07  6:18             ` Damien Le Moal
2017-07-10  5:36           ` Damien Le Moal
2017-07-10 17:26             ` Mike Christie
2017-07-11  0:57               ` Damien Le Moal
2017-07-07 17:19       ` Mike Christie
2017-07-07  5:04   ` Nicholas A. Bellinger
2017-06-28  5:59 ` [PATCH 5/5] target: core: Fix failed command " Damien Le Moal
2017-06-28 17:45   ` Mike Christie
2017-07-07  5:06   ` Nicholas A. Bellinger
2017-06-28 14:34 ` [PATCH 0/5] target: Zoned block device support and bug fixes Bryant G. Ly
2017-06-29  2:24   ` Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170628055900.22889-3-damien.lemoal@wdc.com \
    --to=damien.lemoal@wdc.com \
    --cc=bart.vanassche@sandisk.com \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nab@linux-iscsi.org \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.