aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_device.c
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2012-11-15 14:02:49 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2012-11-15 15:27:21 -0500
commit773cbaf7460aa58c67d4dca83c3f8bca10323bbe (patch)
tree91e6015ade8d62c34c64861f1f3810b3c15a6a25 /drivers/target/target_core_device.c
parentcd063bef414c51d79b9c6ea7a8ef8f9d319529bc (diff)
target: Add/check max_write_same_len device attribute + update block limits VPD
This patch adds a new max_write_same_len device attribute for use with WRITE_SAME w/ UNMAP=0 backend emulation. This can be useful for lowering the default backend value (IBLOCK uses 0xFFFF). Also, update block limits VPD emulation code in spc_emulate_evpd_b0() to report MAXIMUM WRITE SAME LENGTH, and enforce max_write_same_len during sbc_parse() -> sbc_setup_write_same() CDB sanity checking for all emulated WRITE_SAME w/ UNMAP=0 cases. (Robert: Move max_write_same_len check in sbc_setup_write_same() to check both WRITE_SAME w/ UNMAP=1 and w/ UNMAP=0 cases) Cc: Christoph Hellwig <hch@lst.de> Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: Robert Elliott <Elliott@hp.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_device.c')
-rw-r--r--drivers/target/target_core_device.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
index 599374e6d245..54439bc42dab 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -706,6 +706,16 @@ int se_dev_set_unmap_granularity_alignment(
706 return 0; 706 return 0;
707} 707}
708 708
709int se_dev_set_max_write_same_len(
710 struct se_device *dev,
711 u32 max_write_same_len)
712{
713 dev->dev_attrib.max_write_same_len = max_write_same_len;
714 pr_debug("dev[%p]: Set max_write_same_len: %u\n",
715 dev, dev->dev_attrib.max_write_same_len);
716 return 0;
717}
718
709int se_dev_set_emulate_dpo(struct se_device *dev, int flag) 719int se_dev_set_emulate_dpo(struct se_device *dev, int flag)
710{ 720{
711 if (flag != 0 && flag != 1) { 721 if (flag != 0 && flag != 1) {
@@ -1393,6 +1403,7 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
1393 dev->dev_attrib.unmap_granularity = DA_UNMAP_GRANULARITY_DEFAULT; 1403 dev->dev_attrib.unmap_granularity = DA_UNMAP_GRANULARITY_DEFAULT;
1394 dev->dev_attrib.unmap_granularity_alignment = 1404 dev->dev_attrib.unmap_granularity_alignment =
1395 DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT; 1405 DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT;
1406 dev->dev_attrib.max_write_same_len = DA_MAX_WRITE_SAME_LEN;
1396 dev->dev_attrib.fabric_max_sectors = DA_FABRIC_MAX_SECTORS; 1407 dev->dev_attrib.fabric_max_sectors = DA_FABRIC_MAX_SECTORS;
1397 dev->dev_attrib.optimal_sectors = DA_FABRIC_MAX_SECTORS; 1408 dev->dev_attrib.optimal_sectors = DA_FABRIC_MAX_SECTORS;
1398 1409