[PATCH 3/5] SBC: initial WRITE_SAME16 support. (no unmap support)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Initial support for WRITE_SAME16.
This command is largely the same as WRITE_SAME10.
No support for using the command to perform UNMAP of blocks on thin provisioned LUNs yet.

WRITE_SAME16 only works for the bs_rdwr backend for now. We can add support to bs_aio at a later stage.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx>
---
 usr/bs_aio.c  |    1 +
 usr/bs_rdwr.c |    1 +
 usr/sbc.c     |    4 +++-
 usr/scsi.c    |    2 ++
 usr/scsi.h    |    1 +
 5 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/usr/bs_aio.c b/usr/bs_aio.c
index d69c6a1..0b19a7c 100644
--- a/usr/bs_aio.c
+++ b/usr/bs_aio.c
@@ -207,6 +207,7 @@ static int bs_aio_cmd_submit(struct scsi_cmd *cmd)
 		break;
 
 	case WRITE_SAME:
+	case WRITE_SAME_16:
 		eprintf("WRITE_SAME not yet supported for AIO backend.\n");
 		return -1;
 
diff --git a/usr/bs_rdwr.c b/usr/bs_rdwr.c
index 5110a90..cd4518b 100644
--- a/usr/bs_rdwr.c
+++ b/usr/bs_rdwr.c
@@ -113,6 +113,7 @@ static void bs_rdwr_request(struct scsi_cmd *cmd)
 
 		break;
 	case WRITE_SAME:
+	case WRITE_SAME_16:
 		while (tl > 0) {
 			blocksize = 1 << cmd->dev->blk_shift;
 			tmpbuf = scsi_get_out_buffer(cmd);
diff --git a/usr/sbc.c b/usr/sbc.c
index cf72e65..de0a13b 100644
--- a/usr/sbc.c
+++ b/usr/sbc.c
@@ -229,6 +229,7 @@ static int sbc_rw(int host_no, struct scsi_cmd *cmd)
 		}
 		break;
 	case WRITE_SAME:
+	case WRITE_SAME_16:
 		/* We only support protection information type 0 */
 		if (cmd->scb[1] & 0xe0) {
 			key = ILLEGAL_REQUEST;
@@ -251,6 +252,7 @@ static int sbc_rw(int host_no, struct scsi_cmd *cmd)
 		case WRITE_12:
 		case WRITE_16:
 		case WRITE_SAME:
+		case WRITE_SAME_16:
 		case PRE_FETCH_10:
 		case PRE_FETCH_16:
 			key = DATA_PROTECT;
@@ -683,7 +685,7 @@ static struct device_type_template sbc_template = {
 		{sbc_rw, NULL, PR_EA_FA|PR_EA_FN}, /*PRE_FETCH_16 */
 		{sbc_sync_cache, NULL, PR_WE_FA|PR_EA_FA|PR_WE_FN|PR_EA_FN},
 		{spc_illegal_op,},
-		{spc_illegal_op,},
+		{sbc_rw,},		/* WRITE_SAME_16 */
 		{spc_illegal_op,},
 		{spc_illegal_op,},
 		{spc_illegal_op,},
diff --git a/usr/scsi.c b/usr/scsi.c
index c46753e..20382f1 100644
--- a/usr/scsi.c
+++ b/usr/scsi.c
@@ -133,6 +133,7 @@ uint64_t scsi_rw_offset(uint8_t *scb)
 	case WRITE_16:
 	case VERIFY_16:
 	case WRITE_VERIFY_16:
+	case WRITE_SAME_16:
 	case SYNCHRONIZE_CACHE_16:
 		off = (uint64_t)scb[2] << 56 | (uint64_t)scb[3] << 48 |
 			(uint64_t)scb[4] << 40 | (uint64_t)scb[5] << 32 |
@@ -179,6 +180,7 @@ uint32_t scsi_rw_count(uint8_t *scb)
 	case WRITE_16:
 	case VERIFY_16:
 	case WRITE_VERIFY_16:
+	case WRITE_SAME_16:
 	case SYNCHRONIZE_CACHE_16:
 		cnt = (uint32_t)scb[10] << 24 | (uint32_t)scb[11] << 16 |
 			(uint32_t)scb[12] << 8 | (uint32_t)scb[13];
diff --git a/usr/scsi.h b/usr/scsi.h
index 1508cc6..0a02c36 100644
--- a/usr/scsi.h
+++ b/usr/scsi.h
@@ -77,6 +77,7 @@
 #define VERIFY_16	      0x8f
 #define PRE_FETCH_16          0x90
 #define SYNCHRONIZE_CACHE_16  0x91
+#define WRITE_SAME_16         0x93
 #define SERVICE_ACTION_IN     0x9e
 #define	SAI_READ_CAPACITY_16  0x10
 #define REPORT_LUNS           0xa0
-- 
1.7.3.1

--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Linux RAID]     [Linux Clusters]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]

  Powered by Linux