From 773cbaf7460aa58c67d4dca83c3f8bca10323bbe Mon Sep 17 00:00:00 2001 From: Nicholas Bellinger Date: Thu, 15 Nov 2012 11:02:49 -0800 Subject: 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 Cc: Martin K. Petersen Cc: Robert Elliott Signed-off-by: Nicholas Bellinger --- include/target/target_core_base.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/target') diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 5350f6e580f0..645d90ac6097 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -71,6 +71,8 @@ #define DA_UNMAP_GRANULARITY_DEFAULT 0 /* Default unmap_granularity_alignment */ #define DA_UNMAP_GRANULARITY_ALIGNMENT_DEFAULT 0 +/* Default max_write_same_len, disabled by default */ +#define DA_MAX_WRITE_SAME_LEN 0 /* Default max transfer length */ #define DA_FABRIC_MAX_SECTORS 8192 /* Emulation for Direct Page Out */ @@ -609,6 +611,7 @@ struct se_dev_attrib { u32 max_unmap_block_desc_count; u32 unmap_granularity; u32 unmap_granularity_alignment; + u32 max_write_same_len; struct se_device *da_dev; struct config_group da_group; }; -- cgit v1.2.3-59-g8ed1b