diff options
author | Nicholas Bellinger <nab@daterainc.com> | 2013-08-22 17:17:20 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2013-09-10 19:48:46 -0400 |
commit | d397a445f43c7ae9b35260f236a08d5b5760de3d (patch) | |
tree | 9bc760fc767b73a5a20cba6e4ddd0154aa7003a6 /drivers | |
parent | 04b1b7954649767f2ab9bf08cf2457e21d5c7167 (diff) |
target: Add Third Party Copy (3PC) bit in INQUIRY response
This patch adds the Third Party Copy (3PC) bit to signal support
for EXTENDED_COPY within standard inquiry response data.
Also add emulate_3pc device attribute in configfs (enabled by default)
to allow the exposure of this bit to be disabled, if necessary.
Cc: Christoph Hellwig <hch@lst.de>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Martin Petersen <martin.petersen@oracle.com>
Cc: Chris Mason <chris.mason@fusionio.com>
Cc: Roland Dreier <roland@purestorage.com>
Cc: Zach Brown <zab@redhat.com>
Cc: James Bottomley <JBottomley@Parallels.com>
Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@daterainc.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/target/target_core_configfs.c | 4 | ||||
-rw-r--r-- | drivers/target/target_core_device.c | 14 | ||||
-rw-r--r-- | drivers/target/target_core_internal.h | 1 | ||||
-rw-r--r-- | drivers/target/target_core_spc.c | 6 |
4 files changed, 25 insertions, 0 deletions
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 939ecc5679cd..026e42bc4b5f 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -639,6 +639,9 @@ SE_DEV_ATTR(emulate_tpws, S_IRUGO | S_IWUSR); | |||
639 | DEF_DEV_ATTRIB(emulate_caw); | 639 | DEF_DEV_ATTRIB(emulate_caw); |
640 | SE_DEV_ATTR(emulate_caw, S_IRUGO | S_IWUSR); | 640 | SE_DEV_ATTR(emulate_caw, S_IRUGO | S_IWUSR); |
641 | 641 | ||
642 | DEF_DEV_ATTRIB(emulate_3pc); | ||
643 | SE_DEV_ATTR(emulate_3pc, S_IRUGO | S_IWUSR); | ||
644 | |||
642 | DEF_DEV_ATTRIB(enforce_pr_isids); | 645 | DEF_DEV_ATTRIB(enforce_pr_isids); |
643 | SE_DEV_ATTR(enforce_pr_isids, S_IRUGO | S_IWUSR); | 646 | SE_DEV_ATTR(enforce_pr_isids, S_IRUGO | S_IWUSR); |
644 | 647 | ||
@@ -697,6 +700,7 @@ static struct configfs_attribute *target_core_dev_attrib_attrs[] = { | |||
697 | &target_core_dev_attrib_emulate_tpu.attr, | 700 | &target_core_dev_attrib_emulate_tpu.attr, |
698 | &target_core_dev_attrib_emulate_tpws.attr, | 701 | &target_core_dev_attrib_emulate_tpws.attr, |
699 | &target_core_dev_attrib_emulate_caw.attr, | 702 | &target_core_dev_attrib_emulate_caw.attr, |
703 | &target_core_dev_attrib_emulate_3pc.attr, | ||
700 | &target_core_dev_attrib_enforce_pr_isids.attr, | 704 | &target_core_dev_attrib_enforce_pr_isids.attr, |
701 | &target_core_dev_attrib_is_nonrot.attr, | 705 | &target_core_dev_attrib_is_nonrot.attr, |
702 | &target_core_dev_attrib_emulate_rest_reord.attr, | 706 | &target_core_dev_attrib_emulate_rest_reord.attr, |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index b2b081236abb..f9f17934f956 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -906,6 +906,19 @@ int se_dev_set_emulate_caw(struct se_device *dev, int flag) | |||
906 | return 0; | 906 | return 0; |
907 | } | 907 | } |
908 | 908 | ||
909 | int se_dev_set_emulate_3pc(struct se_device *dev, int flag) | ||
910 | { | ||
911 | if (flag != 0 && flag != 1) { | ||
912 | pr_err("Illegal value %d\n", flag); | ||
913 | return -EINVAL; | ||
914 | } | ||
915 | dev->dev_attrib.emulate_3pc = flag; | ||
916 | pr_debug("dev[%p]: SE Device 3rd Party Copy (EXTENDED_COPY): %d\n", | ||
917 | dev, flag); | ||
918 | |||
919 | return 0; | ||
920 | } | ||
921 | |||
909 | int se_dev_set_enforce_pr_isids(struct se_device *dev, int flag) | 922 | int se_dev_set_enforce_pr_isids(struct se_device *dev, int flag) |
910 | { | 923 | { |
911 | if ((flag != 0) && (flag != 1)) { | 924 | if ((flag != 0) && (flag != 1)) { |
@@ -1442,6 +1455,7 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name) | |||
1442 | dev->dev_attrib.emulate_tpu = DA_EMULATE_TPU; | 1455 | dev->dev_attrib.emulate_tpu = DA_EMULATE_TPU; |
1443 | dev->dev_attrib.emulate_tpws = DA_EMULATE_TPWS; | 1456 | dev->dev_attrib.emulate_tpws = DA_EMULATE_TPWS; |
1444 | dev->dev_attrib.emulate_caw = DA_EMULATE_CAW; | 1457 | dev->dev_attrib.emulate_caw = DA_EMULATE_CAW; |
1458 | dev->dev_attrib.emulate_3pc = DA_EMULATE_3PC; | ||
1445 | dev->dev_attrib.enforce_pr_isids = DA_ENFORCE_PR_ISIDS; | 1459 | dev->dev_attrib.enforce_pr_isids = DA_ENFORCE_PR_ISIDS; |
1446 | dev->dev_attrib.is_nonrot = DA_IS_NONROT; | 1460 | dev->dev_attrib.is_nonrot = DA_IS_NONROT; |
1447 | dev->dev_attrib.emulate_rest_reord = DA_EMULATE_REST_REORD; | 1461 | dev->dev_attrib.emulate_rest_reord = DA_EMULATE_REST_REORD; |
diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h index 805ceb4285b8..579128abe3f5 100644 --- a/drivers/target/target_core_internal.h +++ b/drivers/target/target_core_internal.h | |||
@@ -34,6 +34,7 @@ int se_dev_set_emulate_tas(struct se_device *, int); | |||
34 | int se_dev_set_emulate_tpu(struct se_device *, int); | 34 | int se_dev_set_emulate_tpu(struct se_device *, int); |
35 | int se_dev_set_emulate_tpws(struct se_device *, int); | 35 | int se_dev_set_emulate_tpws(struct se_device *, int); |
36 | int se_dev_set_emulate_caw(struct se_device *, int); | 36 | int se_dev_set_emulate_caw(struct se_device *, int); |
37 | int se_dev_set_emulate_3pc(struct se_device *, int); | ||
37 | int se_dev_set_enforce_pr_isids(struct se_device *, int); | 38 | int se_dev_set_enforce_pr_isids(struct se_device *, int); |
38 | int se_dev_set_is_nonrot(struct se_device *, int); | 39 | int se_dev_set_is_nonrot(struct se_device *, int); |
39 | int se_dev_set_emulate_rest_reord(struct se_device *dev, int); | 40 | int se_dev_set_emulate_rest_reord(struct se_device *dev, int); |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 894e83bc223d..566dd2794679 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
@@ -95,6 +95,12 @@ spc_emulate_inquiry_std(struct se_cmd *cmd, unsigned char *buf) | |||
95 | */ | 95 | */ |
96 | spc_fill_alua_data(lun->lun_sep, buf); | 96 | spc_fill_alua_data(lun->lun_sep, buf); |
97 | 97 | ||
98 | /* | ||
99 | * Set Third-Party Copy (3PC) bit to indicate support for EXTENDED_COPY | ||
100 | */ | ||
101 | if (dev->dev_attrib.emulate_3pc) | ||
102 | buf[5] |= 0x8; | ||
103 | |||
98 | buf[7] = 0x2; /* CmdQue=1 */ | 104 | buf[7] = 0x2; /* CmdQue=1 */ |
99 | 105 | ||
100 | snprintf(&buf[8], 8, "LIO-ORG"); | 106 | snprintf(&buf[8], 8, "LIO-ORG"); |