summaryrefslogtreecommitdiff
path: root/drivers/target/target_core_sbc.c
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2015-02-08 03:06:17 -0800
committerNicholas Bellinger <nab@linux-iscsi.org>2015-04-07 23:26:43 -0700
commit5132d1e655dc4befcc075ef32a261eb9733bb04c (patch)
treee3c4c4b661427e64eb901db72747d7ad66132f52 /drivers/target/target_core_sbc.c
parentaa58b53168e12342aa0561c12bf5d6729487c63e (diff)
target: Add internal WRITE_STRIP support
This patch adds WRITE_STRIP support in target_write_prot_action() that invokes sbc_dif_verify_write() for checking T10-PI metadata before submitting the I/O to a backend driver. Upon verify failure, the specific sense code is propigated up the failure path up to transport_generic_request_failure(). Also, update sbc_dif_verify_write() to only perform the subsequent protection metadata copy when a valid *sg is passed. (Use ilog2 instead of division and unlikely for pi_err - Sagi) Reviewed-by: Martin Petersen <martin.petersen@oracle.com> Reviewed-by: Sagi Grimberg <sagig@mellanox.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_sbc.c')
-rw-r--r--drivers/target/target_core_sbc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index 67bc1886f004..315ff641408b 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -1342,6 +1342,9 @@ sbc_dif_verify_write(struct se_cmd *cmd, sector_t start, unsigned int sectors,
kunmap_atomic(paddr);
kunmap_atomic(daddr);
}
+ if (!sg)
+ return 0;
+
sbc_dif_copy_prot(cmd, sectors, false, sg, sg_off);
return 0;