Re: [PATCH 1/1] arcmsr: Notify has sense data report

2014-11-28 Thread Hannes Reinecke
On 11/28/2014 05:20 AM, Ching Huang wrote:
 From: Ching Huang ching2...@areca.com.tw
 
 This patch is relative to 
 http://git.infradead.org/users/hch/scsi-queue.git/tree/refs/heads/drivers-for-3.18:/drivers/scsi/arcmsr
 
 Setting command status with 'DRIVER_SENSE' except 'CHECK_CONDITION' if we 
 have sense data.
 
 Signed-off-by: Ching Huang ching2...@areca.com.tw
 ---
 
 diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
 --- a/drivers/scsi/arcmsr/arcmsr.h2014-09-19 11:04:41.84510 +0800
 +++ b/drivers/scsi/arcmsr/arcmsr.h2014-11-28 10:54:30.0 +0800
 @@ -52,7 +52,7 @@ struct device_attribute;
   #define ARCMSR_MAX_FREECCB_NUM  320
  #define ARCMSR_MAX_OUTSTANDING_CMD   255
  #endif
 -#define ARCMSR_DRIVER_VERSIONv1.30.00.04-20140919
 +#define ARCMSR_DRIVER_VERSIONv1.30.00.05-20141128
  #define ARCMSR_SCSI_INITIATOR_ID 
 255
  #define ARCMSR_MAX_XFER_SECTORS  
 512
  #define ARCMSR_MAX_XFER_SECTORS_B
 4096
 diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c 
 b/drivers/scsi/arcmsr/arcmsr_hba.c
 --- a/drivers/scsi/arcmsr/arcmsr_hba.c2014-09-19 11:01:26.99009 
 +0800
 +++ b/drivers/scsi/arcmsr/arcmsr_hba.c2014-11-28 10:55:54.0 
 +0800
 @@ -989,7 +989,8 @@ static void arcmsr_report_sense_info(str
  
   struct scsi_cmnd *pcmd = ccb-pcmd;
   struct SENSE_DATA *sensebuffer = (struct SENSE_DATA 
 *)pcmd-sense_buffer;
 - pcmd-result = DID_OK  16;
 +
 + pcmd-result = (DID_OK  16) | (CHECK_CONDITION  1);
   if (sensebuffer) {
   int sense_data_length =
   sizeof(struct SENSE_DATA)  SCSI_SENSE_BUFFERSIZE
 @@ -998,6 +999,7 @@ static void arcmsr_report_sense_info(str
   memcpy(sensebuffer, ccb-arcmsr_cdb.SenseData, 
 sense_data_length);
   sensebuffer-ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
   sensebuffer-Valid = 1;
 + pcmd-result |= (DRIVER_SENSE  24);
   }
  }
 
Hmm; we actually _always_ attach a sense buffer to the command.
So the check for 'if (sensebuffer)' will always return true.

I'd rather use a 'WARN_ON' here and get rid of the 'if' clause.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries  Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/16] target/pscsi: Convert to external pscsi_backend_dev_attrs

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch converts PSCSI to use an external set of device attributes,
and utilizes target_core_backend_configfs.h macros to generate a default
set of configfs extended-attr handlers.

It calls target_core_setup_sub_cits() to setup the initial config_item_type
based on existing target_core_configfs.c defaults, and using configfs_attribute
for hw_pi_prot_type, hw_block_size, hw_max_sectors, hw_queue_depth populates
pscsi_backend_dev_attrs[]

Only these four hw_* read-only device attributes are exports for PSCSI.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_pscsi.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/drivers/target/target_core_pscsi.c 
b/drivers/target/target_core_pscsi.c
index 7c8291f..74873e4 100644
--- a/drivers/target/target_core_pscsi.c
+++ b/drivers/target/target_core_pscsi.c
@@ -44,6 +44,7 @@
 
 #include target/target_core_base.h
 #include target/target_core_backend.h
+#include target/target_core_backend_configfs.h
 
 #include target_core_alua.h
 #include target_core_pscsi.h
@@ -1165,6 +1166,26 @@ static void pscsi_req_done(struct request *req, int 
uptodate)
kfree(pt);
 }
 
+DEF_TB_DEV_ATTRIB_RO(pscsi, hw_pi_prot_type);
+TB_DEV_ATTR_RO(pscsi, hw_pi_prot_type);
+
+DEF_TB_DEV_ATTRIB_RO(pscsi, hw_block_size);
+TB_DEV_ATTR_RO(pscsi, hw_block_size);
+
+DEF_TB_DEV_ATTRIB_RO(pscsi, hw_max_sectors);
+TB_DEV_ATTR_RO(pscsi, hw_max_sectors);
+
+DEF_TB_DEV_ATTRIB_RO(pscsi, hw_queue_depth);
+TB_DEV_ATTR_RO(pscsi, hw_queue_depth);
+
+static struct configfs_attribute *pscsi_backend_dev_attrs[] = {
+   pscsi_dev_attrib_hw_pi_prot_type.attr,
+   pscsi_dev_attrib_hw_block_size.attr,
+   pscsi_dev_attrib_hw_max_sectors.attr,
+   pscsi_dev_attrib_hw_queue_depth.attr,
+   NULL,
+};
+
 static struct se_subsystem_api pscsi_template = {
.name   = pscsi,
.owner  = THIS_MODULE,
@@ -1185,6 +1206,11 @@ static struct se_subsystem_api pscsi_template = {
 
 static int __init pscsi_module_init(void)
 {
+   struct target_backend_cits *tbc = pscsi_template.tb_cits;
+
+   target_core_setup_sub_cits(pscsi_template);
+   tbc-tb_dev_attrib_cit.ct_attrs = pscsi_backend_dev_attrs;
+
return transport_subsystem_register(pscsi_template);
 }
 
-- 
1.9.1

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


[PATCH 16/16] target: Drop left-over PHBA_PDEV set attr checks

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

Now that PSCSI is only exposing four hw_* read-only device attributes,
go ahead and drop the left-over - legacy PHBA_PDEV checks in various
se_dev_set_* code, since it's now only used by virtual devices.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_device.c | 64 ++---
 1 file changed, 10 insertions(+), 54 deletions(-)

diff --git a/drivers/target/target_core_device.c 
b/drivers/target/target_core_device.c
index 953fff7..7653cfb 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -767,12 +767,6 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, 
int flag)
pr_err(Illegal value %d\n, flag);
return -EINVAL;
}
-
-   if (flag 
-   dev-transport-transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) {
-   pr_err(emulate_fua_write not supported for pSCSI\n);
-   return -EINVAL;
-   }
dev-dev_attrib.emulate_fua_write = flag;
pr_debug(dev[%p]: SE Device Forced Unit Access WRITEs: %d\n,
dev, dev-dev_attrib.emulate_fua_write);
@@ -803,11 +797,6 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, 
int flag)
return -EINVAL;
}
if (flag 
-   dev-transport-transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) {
-   pr_err(emulate_write_cache not supported for pSCSI\n);
-   return -EINVAL;
-   }
-   if (flag 
dev-transport-get_write_cache) {
pr_err(emulate_write_cache not supported for this device\n);
return -EINVAL;
@@ -1098,26 +1087,15 @@ int se_dev_set_queue_depth(struct se_device *dev, u32 
queue_depth)
return -EINVAL;
}
 
-   if (dev-transport-transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) {
+   if (queue_depth  dev-dev_attrib.queue_depth) {
if (queue_depth  dev-dev_attrib.hw_queue_depth) {
-   pr_err(dev[%p]: Passed queue_depth: %u
-exceeds TCM/SE_Device TCQ: %u\n,
-   dev, queue_depth,
+   pr_err(dev[%p]: Passed queue_depth:
+%u exceeds TCM/SE_Device MAX
+TCQ: %u\n, dev, queue_depth,
dev-dev_attrib.hw_queue_depth);
return -EINVAL;
}
-   } else {
-   if (queue_depth  dev-dev_attrib.queue_depth) {
-   if (queue_depth  dev-dev_attrib.hw_queue_depth) {
-   pr_err(dev[%p]: Passed queue_depth:
-%u exceeds TCM/SE_Device MAX
-TCQ: %u\n, dev, queue_depth,
-   dev-dev_attrib.hw_queue_depth);
-   return -EINVAL;
-   }
-   }
}
-
dev-dev_attrib.queue_depth = dev-queue_depth = queue_depth;
pr_debug(dev[%p]: SE Device TCQ Depth changed to: %u\n,
dev, queue_depth);
@@ -1146,22 +1124,12 @@ int se_dev_set_fabric_max_sectors(struct se_device 
*dev, u32 fabric_max_sectors)
DA_STATUS_MAX_SECTORS_MIN);
return -EINVAL;
}
-   if (dev-transport-transport_type == TRANSPORT_PLUGIN_PHBA_PDEV) {
-   if (fabric_max_sectors  dev-dev_attrib.hw_max_sectors) {
-   pr_err(dev[%p]: Passed fabric_max_sectors: %u
-greater than TCM/SE_Device max_sectors:
-%u\n, dev, fabric_max_sectors,
-   dev-dev_attrib.hw_max_sectors);
-return -EINVAL;
-   }
-   } else {
-   if (fabric_max_sectors  DA_STATUS_MAX_SECTORS_MAX) {
-   pr_err(dev[%p]: Passed fabric_max_sectors: %u
-greater than DA_STATUS_MAX_SECTORS_MAX:
-%u\n, dev, fabric_max_sectors,
-   DA_STATUS_MAX_SECTORS_MAX);
-   return -EINVAL;
-   }
+   if (fabric_max_sectors  DA_STATUS_MAX_SECTORS_MAX) {
+   pr_err(dev[%p]: Passed fabric_max_sectors: %u
+greater than DA_STATUS_MAX_SECTORS_MAX:
+%u\n, dev, fabric_max_sectors,
+   DA_STATUS_MAX_SECTORS_MAX);
+   return -EINVAL;
}
/*
 * Align max_sectors down to PAGE_SIZE to follow 
transport_allocate_data_tasks()
@@ -1188,11 +1156,6 @@ int se_dev_set_optimal_sectors(struct se_device *dev, 
u32 optimal_sectors)
dev, dev-export_count);
return -EINVAL;
}
-   if 

[PATCH 12/16] target/rd: Convert to external rd_mcp_backend_dev_attrs

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch converts RAMDISK to use an external set of device attributes,
and utilizes target_core_backend_configfs.h macros to generate a default
set of configfs extended-attr handlers.

It calls target_core_setup_sub_cits() to setup the initial config_item_type
based on existing target_core_configfs.c defaults, and using configfs_attribute
generated by DEF_TB_DEFAULT_ATTRIBS(rc_mcp) populates rd_mcp_backend_dev_attrs[]

It introduces no functional change for existing RD_MCP device attributes.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_rd.c | 41 +
 1 file changed, 41 insertions(+)

diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
index b920db3..60ebd17 100644
--- a/drivers/target/target_core_rd.c
+++ b/drivers/target/target_core_rd.c
@@ -34,6 +34,7 @@
 
 #include target/target_core_base.h
 #include target/target_core_backend.h
+#include target/target_core_backend_configfs.h
 
 #include target_core_rd.h
 
@@ -632,6 +633,42 @@ rd_parse_cdb(struct se_cmd *cmd)
return sbc_parse_cdb(cmd, rd_sbc_ops);
 }
 
+DEF_TB_DEFAULT_ATTRIBS(rd_mcp);
+
+static struct configfs_attribute *rd_mcp_backend_dev_attrs[] = {
+   rd_mcp_dev_attrib_emulate_model_alias.attr,
+   rd_mcp_dev_attrib_emulate_dpo.attr,
+   rd_mcp_dev_attrib_emulate_fua_write.attr,
+   rd_mcp_dev_attrib_emulate_fua_read.attr,
+   rd_mcp_dev_attrib_emulate_write_cache.attr,
+   rd_mcp_dev_attrib_emulate_ua_intlck_ctrl.attr,
+   rd_mcp_dev_attrib_emulate_tas.attr,
+   rd_mcp_dev_attrib_emulate_tpu.attr,
+   rd_mcp_dev_attrib_emulate_tpws.attr,
+   rd_mcp_dev_attrib_emulate_caw.attr,
+   rd_mcp_dev_attrib_emulate_3pc.attr,
+   rd_mcp_dev_attrib_pi_prot_type.attr,
+   rd_mcp_dev_attrib_hw_pi_prot_type.attr,
+   rd_mcp_dev_attrib_pi_prot_format.attr,
+   rd_mcp_dev_attrib_enforce_pr_isids.attr,
+   rd_mcp_dev_attrib_is_nonrot.attr,
+   rd_mcp_dev_attrib_emulate_rest_reord.attr,
+   rd_mcp_dev_attrib_force_pr_aptpl.attr,
+   rd_mcp_dev_attrib_hw_block_size.attr,
+   rd_mcp_dev_attrib_block_size.attr,
+   rd_mcp_dev_attrib_hw_max_sectors.attr,
+   rd_mcp_dev_attrib_fabric_max_sectors.attr,
+   rd_mcp_dev_attrib_optimal_sectors.attr,
+   rd_mcp_dev_attrib_hw_queue_depth.attr,
+   rd_mcp_dev_attrib_queue_depth.attr,
+   rd_mcp_dev_attrib_max_unmap_lba_count.attr,
+   rd_mcp_dev_attrib_max_unmap_block_desc_count.attr,
+   rd_mcp_dev_attrib_unmap_granularity.attr,
+   rd_mcp_dev_attrib_unmap_granularity_alignment.attr,
+   rd_mcp_dev_attrib_max_write_same_len.attr,
+   NULL,
+};
+
 static struct se_subsystem_api rd_mcp_template = {
.name   = rd_mcp,
.inquiry_prod   = RAMDISK-MCP,
@@ -653,8 +690,12 @@ static struct se_subsystem_api rd_mcp_template = {
 
 int __init rd_module_init(void)
 {
+   struct target_backend_cits *tbc = rd_mcp_template.tb_cits;
int ret;
 
+   target_core_setup_sub_cits(rd_mcp_template);
+   tbc-tb_dev_attrib_cit.ct_attrs = rd_mcp_backend_dev_attrs;
+
ret = transport_subsystem_register(rd_mcp_template);
if (ret  0) {
return ret;
-- 
1.9.1

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


[PATCH 10/16] target/iblock: Convert to external iblock_backend_dev_attrs

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch converts IBLOCK to use an external set of device attributes,
and utilizes target_core_backend_configfs.h macros to generate a default
set of configfs extended-attr handlers.

It calls target_core_setup_sub_cits() to setup the initial config_item_type
based on existing target_core_configfs.c defaults, and using configfs_attribute
generated by DEF_TB_DEFAULT_ATTRIBS(iblock) populates iblock_backend_dev_attrs[]

It introduces no functional change for existing IBLOCK device attributes.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_iblock.c | 41 +
 1 file changed, 41 insertions(+)

diff --git a/drivers/target/target_core_iblock.c 
b/drivers/target/target_core_iblock.c
index 5e69d36..3efff94 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -41,6 +41,7 @@
 
 #include target/target_core_base.h
 #include target/target_core_backend.h
+#include target/target_core_backend_configfs.h
 
 #include target_core_iblock.h
 
@@ -858,6 +859,41 @@ static bool iblock_get_write_cache(struct se_device *dev)
return q-flush_flags  REQ_FLUSH;
 }
 
+DEF_TB_DEFAULT_ATTRIBS(iblock);
+
+static struct configfs_attribute *iblock_backend_dev_attrs[] = {
+   iblock_dev_attrib_emulate_model_alias.attr,
+   iblock_dev_attrib_emulate_dpo.attr,
+   iblock_dev_attrib_emulate_fua_write.attr,
+   iblock_dev_attrib_emulate_fua_read.attr,
+   iblock_dev_attrib_emulate_write_cache.attr,
+   iblock_dev_attrib_emulate_ua_intlck_ctrl.attr,
+   iblock_dev_attrib_emulate_tas.attr,
+   iblock_dev_attrib_emulate_tpu.attr,
+   iblock_dev_attrib_emulate_tpws.attr,
+   iblock_dev_attrib_emulate_caw.attr,
+   iblock_dev_attrib_emulate_3pc.attr,
+   iblock_dev_attrib_pi_prot_type.attr,
+   iblock_dev_attrib_hw_pi_prot_type.attr,
+   iblock_dev_attrib_pi_prot_format.attr,
+   iblock_dev_attrib_enforce_pr_isids.attr,
+   iblock_dev_attrib_is_nonrot.attr,
+   iblock_dev_attrib_emulate_rest_reord.attr,
+   iblock_dev_attrib_force_pr_aptpl.attr,
+   iblock_dev_attrib_hw_block_size.attr,
+   iblock_dev_attrib_block_size.attr,
+   iblock_dev_attrib_hw_max_sectors.attr,
+   iblock_dev_attrib_fabric_max_sectors.attr,
+   iblock_dev_attrib_optimal_sectors.attr,
+   iblock_dev_attrib_hw_queue_depth.attr,
+   iblock_dev_attrib_queue_depth.attr,
+   iblock_dev_attrib_max_unmap_lba_count.attr,
+   iblock_dev_attrib_max_unmap_block_desc_count.attr,
+   iblock_dev_attrib_unmap_granularity.attr,
+   iblock_dev_attrib_unmap_granularity_alignment.attr,
+   iblock_dev_attrib_max_write_same_len.attr,
+   NULL,
+};
 
 static struct se_subsystem_api iblock_template = {
.name   = iblock,
@@ -884,6 +920,11 @@ static struct se_subsystem_api iblock_template = {
 
 static int __init iblock_module_init(void)
 {
+   struct target_backend_cits *tbc = iblock_template.tb_cits;
+
+   target_core_setup_sub_cits(iblock_template);
+   tbc-tb_dev_attrib_cit.ct_attrs = iblock_backend_dev_attrs;
+
return transport_subsystem_register(iblock_template);
 }
 
-- 
1.9.1

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


[PATCH 00/16] target: Use external CITs for backend devices

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

Hi all,

This series addresses a long standing limitation going back to early
LIO v3.x days, where all TCM backend devices originally used local
scope struct config_item_types in target_core_configfs.c code that
resulted in same /sys/kernel/config/target/core/$HBA/$DEV/attrib/*
for all se_subsystem_api flavors, regardless of -transport_type.

This has made user-space complexity grow slightly over the years,
causing rtslib + friends to have to determine which device attributes
can be changed at run-time for pSCSI vs. other backend drivers.

On the other hand, existing target_core_fabric_configfs.c logic in
LIO v4.0 has used a method that lets fabric drivers populate their
own driver dependent attributes using struct config_item_type members
within struct target_fabric_configfs-tf_cit_tmpl.  This allows for
config_item_type (CITs) to live within external modules, so fabric
drivers can add new attributes without breaking existing configfs
user-space ABI.

To that end, this series exposes the 6 existing se_device CITs from
target_core_configfs.c externally to backend drivers, and using a
new set of helper macros in target_core_backend_configfs.h converts
existing IBLOCK, FILEIO, RAMDISK, TCM-USER, and PSCSI to populate
their own set of backend device attributes.

Post conversion, IBLOCK, FILEIO, RAMDISK, and TCM-USER device attrs
remain unchanged to user-space via the DEF_TB_DEFAULT_ATTRIBS CPP
magic, and PSCSI now exposes 4 read-only attributes: hw_pi_prot_type,
hw_block_size, hw_max_sectors and hw_queue_depth.

Thanks!

--nab

Nicholas Bellinger (16):
  target: Move dev_cit to struct se_subsystem_api
  target: Move dev_attrib_cit to struct se_subsystem_api
  target: Move dev_pr_cit to struct se_subsystem_api
  target: Move dev_wwn_cit to struct se_subsystem_api
  target: Move dev_alua_tg_pt_gps_cit to struct se_subsystem_api
  target: Move dev_stat_cit to struct se_subsystem_api
  target: Add target_core_backend_configfs.h helper macros
  target: Add EXPORT_SYMBOL for existing se_dev_set_*
  target: Add DEF_TB_DEFAULT_ATTRIBS macro for virtual device attrs
  target/iblock: Convert to external iblock_backend_dev_attrs
  target/file: Convert to external fileio_backend_dev_attrs
  target/rd: Convert to external rd_mcp_backend_dev_attrs
  target/user: Convert to external tcmu_backend_dev_attrs
  target/pscsi: Convert to external pscsi_backend_dev_attrs
  target: Drop left-over internal dev attribute code
  target: Drop left-over PHBA_PDEV set attr checks

 drivers/target/target_core_configfs.c | 269 +-
 drivers/target/target_core_device.c   |  90 -
 drivers/target/target_core_file.c |  42 
 drivers/target/target_core_hba.c  |   1 +
 drivers/target/target_core_iblock.c   |  42 
 drivers/target/target_core_internal.h |  28 ---
 drivers/target/target_core_pscsi.c|  26 +++
 drivers/target/target_core_rd.c   |  41 
 drivers/target/target_core_user.c |  42 
 include/target/target_core_backend.h  |  43 
 include/target/target_core_backend_configfs.h | 120 
 11 files changed, 442 insertions(+), 302 deletions(-)
 create mode 100644 include/target/target_core_backend_configfs.h

-- 
1.9.1

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


[PATCH 15/16] target: Drop left-over internal dev attribute code

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

Now that backend drivers are populating their own device attributes,
go ahead and remove left-over definitions + internal attribute list
of device attributes from target_core_configfs.c code

Also update TB_CIT_SETUP(dev_attrib,...) to signal ct_attr = NULL.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_configfs.c | 176 +-
 1 file changed, 1 insertion(+), 175 deletions(-)

diff --git a/drivers/target/target_core_configfs.c 
b/drivers/target/target_core_configfs.c
index 2903d89..75d89ad 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -586,189 +586,15 @@ EXPORT_SYMBOL(target_fabric_configfs_deregister);
 
 /* Start functions for struct config_item_type tb_dev_attrib_cit */
 
-#define DEF_DEV_ATTRIB_SHOW(_name) \
-static ssize_t target_core_dev_show_attr_##_name(  \
-   struct se_dev_attrib *da,   \
-   char *page) \
-{  \
-   return snprintf(page, PAGE_SIZE, %u\n,\
-   (u32)da-da_dev-dev_attrib._name); \
-}
-
-#define DEF_DEV_ATTRIB_STORE(_name)\
-static ssize_t target_core_dev_store_attr_##_name( \
-   struct se_dev_attrib *da,   \
-   const char *page,   \
-   size_t count)   \
-{  \
-   unsigned long val;  \
-   int ret;\
-   \
-   ret = kstrtoul(page, 0, val);  \
-   if (ret  0) {  \
-   pr_err(kstrtoul() failed with \
-ret: %d\n, ret); \
-   return -EINVAL; \
-   }   \
-   ret = se_dev_set_##_name(da-da_dev, (u32)val); \
-   \
-   return (!ret) ? count : -EINVAL;\
-}
-
-#define DEF_DEV_ATTRIB(_name)  \
-DEF_DEV_ATTRIB_SHOW(_name);\
-DEF_DEV_ATTRIB_STORE(_name);
-
-#define DEF_DEV_ATTRIB_RO(_name)   \
-DEF_DEV_ATTRIB_SHOW(_name);
-
 CONFIGFS_EATTR_STRUCT(target_core_dev_attrib, se_dev_attrib);
-#define SE_DEV_ATTR(_name, _mode)  \
-static struct target_core_dev_attrib_attribute \
-   target_core_dev_attrib_##_name =\
-   __CONFIGFS_EATTR(_name, _mode,  \
-   target_core_dev_show_attr_##_name,  \
-   target_core_dev_store_attr_##_name);
-
-#define SE_DEV_ATTR_RO(_name); \
-static struct target_core_dev_attrib_attribute \
-   target_core_dev_attrib_##_name =\
-   __CONFIGFS_EATTR_RO(_name,  \
-   target_core_dev_show_attr_##_name);
-
-DEF_DEV_ATTRIB(emulate_model_alias);
-SE_DEV_ATTR(emulate_model_alias, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB(emulate_dpo);
-SE_DEV_ATTR(emulate_dpo, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB(emulate_fua_write);
-SE_DEV_ATTR(emulate_fua_write, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB(emulate_fua_read);
-SE_DEV_ATTR(emulate_fua_read, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB(emulate_write_cache);
-SE_DEV_ATTR(emulate_write_cache, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB(emulate_ua_intlck_ctrl);
-SE_DEV_ATTR(emulate_ua_intlck_ctrl, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB(emulate_tas);
-SE_DEV_ATTR(emulate_tas, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB(emulate_tpu);
-SE_DEV_ATTR(emulate_tpu, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB(emulate_tpws);
-SE_DEV_ATTR(emulate_tpws, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB(emulate_caw);
-SE_DEV_ATTR(emulate_caw, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB(emulate_3pc);
-SE_DEV_ATTR(emulate_3pc, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB(pi_prot_type);
-SE_DEV_ATTR(pi_prot_type, S_IRUGO | S_IWUSR);
-
-DEF_DEV_ATTRIB_RO(hw_pi_prot_type);
-SE_DEV_ATTR_RO(hw_pi_prot_type);
-
-DEF_DEV_ATTRIB(pi_prot_format);
-SE_DEV_ATTR(pi_prot_format, S_IRUGO | S_IWUSR);
-

[PATCH 11/16] target/file: Convert to external fileio_backend_dev_attrs

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch converts FILEIO to use an external set of device attributes,
and utilizes target_core_backend_configfs.h macros to generate a default
set of configfs extended-attr handlers.

It calls target_core_setup_sub_cits() to setup the initial config_item_type
based on existing target_core_configfs.c defaults, and using configfs_attribute
generated by DEF_TB_DEFAULT_ATTRIBS(fileio) populates fileio_backend_dev_attrs[]

It introduces no functional change for existing FILEIO device attributes.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_file.c | 42 +++
 1 file changed, 42 insertions(+)

diff --git a/drivers/target/target_core_file.c 
b/drivers/target/target_core_file.c
index 72c83d9..c2aea09 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -37,6 +37,7 @@
 
 #include target/target_core_base.h
 #include target/target_core_backend.h
+#include target/target_core_backend_configfs.h
 
 #include target_core_file.h
 
@@ -934,6 +935,42 @@ fd_parse_cdb(struct se_cmd *cmd)
return sbc_parse_cdb(cmd, fd_sbc_ops);
 }
 
+DEF_TB_DEFAULT_ATTRIBS(fileio);
+
+static struct configfs_attribute *fileio_backend_dev_attrs[] = {
+   fileio_dev_attrib_emulate_model_alias.attr,
+   fileio_dev_attrib_emulate_dpo.attr,
+   fileio_dev_attrib_emulate_fua_write.attr,
+   fileio_dev_attrib_emulate_fua_read.attr,
+   fileio_dev_attrib_emulate_write_cache.attr,
+   fileio_dev_attrib_emulate_ua_intlck_ctrl.attr,
+   fileio_dev_attrib_emulate_tas.attr,
+   fileio_dev_attrib_emulate_tpu.attr,
+   fileio_dev_attrib_emulate_tpws.attr,
+   fileio_dev_attrib_emulate_caw.attr,
+   fileio_dev_attrib_emulate_3pc.attr,
+   fileio_dev_attrib_pi_prot_type.attr,
+   fileio_dev_attrib_hw_pi_prot_type.attr,
+   fileio_dev_attrib_pi_prot_format.attr,
+   fileio_dev_attrib_enforce_pr_isids.attr,
+   fileio_dev_attrib_is_nonrot.attr,
+   fileio_dev_attrib_emulate_rest_reord.attr,
+   fileio_dev_attrib_force_pr_aptpl.attr,
+   fileio_dev_attrib_hw_block_size.attr,
+   fileio_dev_attrib_block_size.attr,
+   fileio_dev_attrib_hw_max_sectors.attr,
+   fileio_dev_attrib_fabric_max_sectors.attr,
+   fileio_dev_attrib_optimal_sectors.attr,
+   fileio_dev_attrib_hw_queue_depth.attr,
+   fileio_dev_attrib_queue_depth.attr,
+   fileio_dev_attrib_max_unmap_lba_count.attr,
+   fileio_dev_attrib_max_unmap_block_desc_count.attr,
+   fileio_dev_attrib_unmap_granularity.attr,
+   fileio_dev_attrib_unmap_granularity_alignment.attr,
+   fileio_dev_attrib_max_write_same_len.attr,
+   NULL,
+};
+
 static struct se_subsystem_api fileio_template = {
.name   = fileio,
.inquiry_prod   = FILEIO,
@@ -957,6 +994,11 @@ static struct se_subsystem_api fileio_template = {
 
 static int __init fileio_module_init(void)
 {
+   struct target_backend_cits *tbc = fileio_template.tb_cits;
+
+   target_core_setup_sub_cits(fileio_template);
+   tbc-tb_dev_attrib_cit.ct_attrs = fileio_backend_dev_attrs;
+
return transport_subsystem_register(fileio_template);
 }
 
-- 
1.9.1

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


[PATCH 01/16] target: Move dev_cit to struct se_subsystem_api

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch adds initial support for dev_cit as external config_item_type.

This includes a new struct target_backend_cits to hold the external CITs
within struct se_subsystem_api, and target_core_setup_sub_cits() to be
used by backend drivers ahead of transport_subsystem_register().

It adds a TB_CIT_SETUP() helper following target_core_fabric_configfs.c
to perform the config_item_type assignments.

Also, drop left-over target_core_dev_cit from target_core_configfs.c code
and update comments.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_configfs.c | 33 -
 drivers/target/target_core_hba.c  |  1 +
 include/target/target_core_backend.h  |  9 +
 3 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/drivers/target/target_core_configfs.c 
b/drivers/target/target_core_configfs.c
index 41498b6..f7b2186 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -50,6 +50,19 @@
 #include target_core_rd.h
 #include target_core_xcopy.h
 
+#define TB_CIT_SETUP(_name, _item_ops, _group_ops, _attrs) \
+static void target_core_setup_##_name##_cit(struct se_subsystem_api *sa) \
+{  \
+   struct target_backend_cits *tbc = sa-tb_cits; \
+   struct config_item_type *cit = tbc-tb_##_name##_cit;  \
+   \
+   cit-ct_item_ops = _item_ops;   \
+   cit-ct_group_ops = _group_ops; \
+   cit-ct_attrs = _attrs; \
+   cit-ct_owner = sa-owner;  \
+   pr_debug(Setup generic %s\n, __stringify(_name)); \
+}
+
 extern struct t10_alua_lu_gp *default_lu_gp;
 
 static LIST_HEAD(g_tf_list);
@@ -1470,7 +1483,7 @@ static struct config_item_type target_core_dev_pr_cit = {
 
 /*  End functions for struct config_item_type target_core_dev_pr_cit */
 
-/*  Start functions for struct config_item_type target_core_dev_cit */
+/*  Start functions for struct config_item_type tb_dev_cit */
 
 static ssize_t target_core_show_dev_info(void *p, char *page)
 {
@@ -1934,7 +1947,7 @@ static struct target_core_configfs_attribute 
target_core_attr_dev_lba_map = {
.store  = target_core_store_dev_lba_map,
 };
 
-static struct configfs_attribute *lio_core_dev_attrs[] = {
+static struct configfs_attribute *target_core_dev_attrs[] = {
target_core_attr_dev_info.attr,
target_core_attr_dev_control.attr,
target_core_attr_dev_alias.attr,
@@ -1993,13 +2006,9 @@ static struct configfs_item_operations 
target_core_dev_item_ops = {
.store_attribute= target_core_dev_store,
 };
 
-static struct config_item_type target_core_dev_cit = {
-   .ct_item_ops= target_core_dev_item_ops,
-   .ct_attrs   = lio_core_dev_attrs,
-   .ct_owner   = THIS_MODULE,
-};
+TB_CIT_SETUP(dev, target_core_dev_item_ops, NULL, target_core_dev_attrs);
 
-/* End functions for struct config_item_type target_core_dev_cit */
+/* End functions for struct config_item_type tb_dev_cit */
 
 /* Start functions for struct config_item_type target_core_alua_lu_gp_cit */
 
@@ -2815,7 +2824,7 @@ static struct config_group *target_core_make_subdev(
if (!dev_cg-default_groups)
goto out_free_device;
 
-   config_group_init_type_name(dev_cg, name, target_core_dev_cit);
+   config_group_init_type_name(dev_cg, name, t-tb_cits.tb_dev_cit);
config_group_init_type_name(dev-dev_attrib.da_group, attrib,
target_core_dev_attrib_cit);
config_group_init_type_name(dev-dev_pr_group, pr,
@@ -3119,6 +3128,12 @@ static struct config_item_type target_core_cit = {
 
 /* Stop functions for struct config_item_type target_core_hba_cit */
 
+void target_core_setup_sub_cits(struct se_subsystem_api *sa)
+{
+   target_core_setup_dev_cit(sa);
+}
+EXPORT_SYMBOL(target_core_setup_sub_cits);
+
 static int __init target_core_init_configfs(void)
 {
struct config_group *target_cg, *hba_cg = NULL, *alua_cg = NULL;
diff --git a/drivers/target/target_core_hba.c b/drivers/target/target_core_hba.c
index e6e496f..ff95f95 100644
--- a/drivers/target/target_core_hba.c
+++ b/drivers/target/target_core_hba.c
@@ -36,6 +36,7 @@
 #include target/target_core_base.h
 #include target/target_core_backend.h
 #include target/target_core_fabric.h
+#include target/target_core_configfs.h
 
 #include target_core_internal.h
 
diff --git a/include/target/target_core_backend.h 
b/include/target/target_core_backend.h
index 9adc1bc..7b84436 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -5,6 +5,10 @@
 #define TRANSPORT_PLUGIN_VHBA_PDEV  

[PATCH 05/16] target: Move dev_alua_tg_pt_gps_cit to struct se_subsystem_api

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch adds support for dev_alua_tg_pt_gps_cit as an external 
config_item_type
using TB_CIT_SETUP() helper macro, and sets only ct_group_ops following
existing code.

It updates target_core_make_subdev() + target_core_setup_dev_attrib_cit() +
struct target_backend_cits, and drops left-over 
target_core_dev_alua_tg_pt_gps_cit
from target_core_configfs.c code and update comments.

This patch introduces no functional change from existing code.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_configfs.c | 12 +---
 include/target/target_core_backend.h  |  1 +
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/target/target_core_configfs.c 
b/drivers/target/target_core_configfs.c
index 43d180e..0cf41ad 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -2677,7 +2677,7 @@ static struct config_item_type 
target_core_alua_tg_pt_gp_cit = {
 
 /* End functions for struct config_item_type target_core_alua_tg_pt_gp_cit */
 
-/* Start functions for struct config_item_type target_core_alua_tg_pt_gps_cit 
*/
+/* Start functions for struct config_item_type tb_alua_tg_pt_gps_cit */
 
 static struct config_group *target_core_alua_create_tg_pt_gp(
struct config_group *group,
@@ -2728,12 +2728,9 @@ static struct configfs_group_operations 
target_core_alua_tg_pt_gps_group_ops = {
.drop_item  = target_core_alua_drop_tg_pt_gp,
 };
 
-static struct config_item_type target_core_alua_tg_pt_gps_cit = {
-   .ct_group_ops   = target_core_alua_tg_pt_gps_group_ops,
-   .ct_owner   = THIS_MODULE,
-};
+TB_CIT_SETUP(dev_alua_tg_pt_gps, NULL, target_core_alua_tg_pt_gps_group_ops, 
NULL);
 
-/* End functions for struct config_item_type target_core_alua_tg_pt_gps_cit */
+/* End functions for struct config_item_type tb_alua_tg_pt_gps_cit */
 
 /* Start functions for struct config_item_type target_core_alua_cit */
 
@@ -2821,7 +2818,7 @@ static struct config_group *target_core_make_subdev(
config_group_init_type_name(dev-t10_wwn.t10_wwn_group, wwn,
t-tb_cits.tb_dev_wwn_cit);
config_group_init_type_name(dev-t10_alua.alua_tg_pt_gps_group,
-   alua, target_core_alua_tg_pt_gps_cit);
+   alua, t-tb_cits.tb_dev_alua_tg_pt_gps_cit);
config_group_init_type_name(dev-dev_stat_grps.stat_group,
statistics, target_core_stat_cit);
 
@@ -3123,6 +3120,7 @@ void target_core_setup_sub_cits(struct se_subsystem_api 
*sa)
target_core_setup_dev_attrib_cit(sa);
target_core_setup_dev_pr_cit(sa);
target_core_setup_dev_wwn_cit(sa);
+   target_core_setup_dev_alua_tg_pt_gps_cit(sa);
 }
 EXPORT_SYMBOL(target_core_setup_sub_cits);
 
diff --git a/include/target/target_core_backend.h 
b/include/target/target_core_backend.h
index 68fad78..157d173 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -10,6 +10,7 @@ struct target_backend_cits {
struct config_item_type tb_dev_attrib_cit;
struct config_item_type tb_dev_pr_cit;
struct config_item_type tb_dev_wwn_cit;
+   struct config_item_type tb_dev_alua_tg_pt_gps_cit;
 };
 
 struct se_subsystem_api {
-- 
1.9.1

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


[PATCH 03/16] target: Move dev_pr_cit to struct se_subsystem_api

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch adds support for dev_pr_cit as an external config_item_type
using TB_CIT_SETUP() helper macro, and sets both ct_item_ops + ct_attr
following existing code.

It updates target_core_make_subdev() + target_core_setup_dev_attrib_cit() +
struct target_backend_cits, and drops left-over target_core_dev_pr_cit
from target_core_configfs.c code and update comments.

This patch introduces no functional change from existing code.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_configfs.c | 13 +
 include/target/target_core_backend.h  |  1 +
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/target/target_core_configfs.c 
b/drivers/target/target_core_configfs.c
index 78ed857..49d51ba 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -1011,7 +1011,7 @@ static struct config_item_type target_core_dev_wwn_cit = {
 
 /*  End functions for struct config_item_type target_core_dev_wwn_cit */
 
-/*  Start functions for struct config_item_type target_core_dev_pr_cit */
+/*  Start functions for struct config_item_type tb_dev_pr_cit */
 
 CONFIGFS_EATTR_STRUCT(target_core_dev_pr, se_device);
 #define SE_DEV_PR_ATTR(_name, _mode)   \
@@ -1472,13 +1472,9 @@ static struct configfs_item_operations 
target_core_dev_pr_ops = {
.store_attribute= target_core_dev_pr_attr_store,
 };
 
-static struct config_item_type target_core_dev_pr_cit = {
-   .ct_item_ops= target_core_dev_pr_ops,
-   .ct_attrs   = target_core_dev_pr_attrs,
-   .ct_owner   = THIS_MODULE,
-};
+TB_CIT_SETUP(dev_pr, target_core_dev_pr_ops, NULL, target_core_dev_pr_attrs);
 
-/*  End functions for struct config_item_type target_core_dev_pr_cit */
+/*  End functions for struct config_item_type tb_dev_pr_cit */
 
 /*  Start functions for struct config_item_type tb_dev_cit */
 
@@ -2825,7 +2821,7 @@ static struct config_group *target_core_make_subdev(
config_group_init_type_name(dev-dev_attrib.da_group, attrib,
t-tb_cits.tb_dev_attrib_cit);
config_group_init_type_name(dev-dev_pr_group, pr,
-   target_core_dev_pr_cit);
+   t-tb_cits.tb_dev_pr_cit);
config_group_init_type_name(dev-t10_wwn.t10_wwn_group, wwn,
target_core_dev_wwn_cit);
config_group_init_type_name(dev-t10_alua.alua_tg_pt_gps_group,
@@ -3129,6 +3125,7 @@ void target_core_setup_sub_cits(struct se_subsystem_api 
*sa)
 {
target_core_setup_dev_cit(sa);
target_core_setup_dev_attrib_cit(sa);
+   target_core_setup_dev_pr_cit(sa);
 }
 EXPORT_SYMBOL(target_core_setup_sub_cits);
 
diff --git a/include/target/target_core_backend.h 
b/include/target/target_core_backend.h
index 735f8567..a47e789 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -8,6 +8,7 @@
 struct target_backend_cits {
struct config_item_type tb_dev_cit;
struct config_item_type tb_dev_attrib_cit;
+   struct config_item_type tb_dev_pr_cit;
 };
 
 struct se_subsystem_api {
-- 
1.9.1

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


[PATCH 02/16] target: Move dev_attrib_cit to struct se_subsystem_api

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch adds support for dev_attrib_cit as an external config_item_type
using TB_CIT_SETUP() helper macro, and sets both ct_item_ops + ct_attr
following existing code.

It updates target_core_make_subdev() + target_core_setup_dev_attrib_cit() +
struct target_backend_cits, and drops left-over target_core_dev_attrib_cit
from target_core_configfs.c code and update comments.

This patch introduces no functional change from existing code.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_configfs.c | 14 ++
 include/target/target_core_backend.h  |  1 +
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/target/target_core_configfs.c 
b/drivers/target/target_core_configfs.c
index f7b2186..78ed857 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -584,7 +584,7 @@ EXPORT_SYMBOL(target_fabric_configfs_deregister);
 // Stop functions called by external Target Fabrics Modules
 
//*/
 
-/* Start functions for struct config_item_type target_core_dev_attrib_cit */
+/* Start functions for struct config_item_type tb_dev_attrib_cit */
 
 #define DEF_DEV_ATTRIB_SHOW(_name) \
 static ssize_t target_core_dev_show_attr_##_name(  \
@@ -767,13 +767,10 @@ static struct configfs_item_operations 
target_core_dev_attrib_ops = {
.store_attribute= target_core_dev_attrib_attr_store,
 };
 
-static struct config_item_type target_core_dev_attrib_cit = {
-   .ct_item_ops= target_core_dev_attrib_ops,
-   .ct_attrs   = target_core_dev_attrib_attrs,
-   .ct_owner   = THIS_MODULE,
-};
+TB_CIT_SETUP(dev_attrib, target_core_dev_attrib_ops, NULL,
+target_core_dev_attrib_attrs);
 
-/* End functions for struct config_item_type target_core_dev_attrib_cit */
+/* End functions for struct config_item_type tb_dev_attrib_cit */
 
 /*  Start functions for struct config_item_type target_core_dev_wwn_cit */
 
@@ -2826,7 +2823,7 @@ static struct config_group *target_core_make_subdev(
 
config_group_init_type_name(dev_cg, name, t-tb_cits.tb_dev_cit);
config_group_init_type_name(dev-dev_attrib.da_group, attrib,
-   target_core_dev_attrib_cit);
+   t-tb_cits.tb_dev_attrib_cit);
config_group_init_type_name(dev-dev_pr_group, pr,
target_core_dev_pr_cit);
config_group_init_type_name(dev-t10_wwn.t10_wwn_group, wwn,
@@ -3131,6 +3128,7 @@ static struct config_item_type target_core_cit = {
 void target_core_setup_sub_cits(struct se_subsystem_api *sa)
 {
target_core_setup_dev_cit(sa);
+   target_core_setup_dev_attrib_cit(sa);
 }
 EXPORT_SYMBOL(target_core_setup_sub_cits);
 
diff --git a/include/target/target_core_backend.h 
b/include/target/target_core_backend.h
index 7b84436..735f8567 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -7,6 +7,7 @@
 
 struct target_backend_cits {
struct config_item_type tb_dev_cit;
+   struct config_item_type tb_dev_attrib_cit;
 };
 
 struct se_subsystem_api {
-- 
1.9.1

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


[PATCH 04/16] target: Move dev_wwn_cit to struct se_subsystem_api

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch adds support for dev_wwn_cit as an external config_item_type
using TB_CIT_SETUP() helper macro, and sets both ct_item_ops + ct_attr
following existing code.

It updates target_core_make_subdev() + target_core_setup_dev_attrib_cit() +
struct target_backend_cits, and drops left-over target_core_dev_wwn_cit
from target_core_configfs.c code and update comments.

This patch introduces no functional change from existing code.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_configfs.c | 13 +
 include/target/target_core_backend.h  |  1 +
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/target/target_core_configfs.c 
b/drivers/target/target_core_configfs.c
index 49d51ba..43d180e 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -772,7 +772,7 @@ TB_CIT_SETUP(dev_attrib, target_core_dev_attrib_ops, NULL,
 
 /* End functions for struct config_item_type tb_dev_attrib_cit */
 
-/*  Start functions for struct config_item_type target_core_dev_wwn_cit */
+/*  Start functions for struct config_item_type tb_dev_wwn_cit */
 
 CONFIGFS_EATTR_STRUCT(target_core_dev_wwn, t10_wwn);
 #define SE_DEV_WWN_ATTR(_name, _mode)  \
@@ -1003,13 +1003,9 @@ static struct configfs_item_operations 
target_core_dev_wwn_ops = {
.store_attribute= target_core_dev_wwn_attr_store,
 };
 
-static struct config_item_type target_core_dev_wwn_cit = {
-   .ct_item_ops= target_core_dev_wwn_ops,
-   .ct_attrs   = target_core_dev_wwn_attrs,
-   .ct_owner   = THIS_MODULE,
-};
+TB_CIT_SETUP(dev_wwn, target_core_dev_wwn_ops, NULL, 
target_core_dev_wwn_attrs);
 
-/*  End functions for struct config_item_type target_core_dev_wwn_cit */
+/*  End functions for struct config_item_type tb_dev_wwn_cit */
 
 /*  Start functions for struct config_item_type tb_dev_pr_cit */
 
@@ -2823,7 +2819,7 @@ static struct config_group *target_core_make_subdev(
config_group_init_type_name(dev-dev_pr_group, pr,
t-tb_cits.tb_dev_pr_cit);
config_group_init_type_name(dev-t10_wwn.t10_wwn_group, wwn,
-   target_core_dev_wwn_cit);
+   t-tb_cits.tb_dev_wwn_cit);
config_group_init_type_name(dev-t10_alua.alua_tg_pt_gps_group,
alua, target_core_alua_tg_pt_gps_cit);
config_group_init_type_name(dev-dev_stat_grps.stat_group,
@@ -3126,6 +3122,7 @@ void target_core_setup_sub_cits(struct se_subsystem_api 
*sa)
target_core_setup_dev_cit(sa);
target_core_setup_dev_attrib_cit(sa);
target_core_setup_dev_pr_cit(sa);
+   target_core_setup_dev_wwn_cit(sa);
 }
 EXPORT_SYMBOL(target_core_setup_sub_cits);
 
diff --git a/include/target/target_core_backend.h 
b/include/target/target_core_backend.h
index a47e789..68fad78 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -9,6 +9,7 @@ struct target_backend_cits {
struct config_item_type tb_dev_cit;
struct config_item_type tb_dev_attrib_cit;
struct config_item_type tb_dev_pr_cit;
+   struct config_item_type tb_dev_wwn_cit;
 };
 
 struct se_subsystem_api {
-- 
1.9.1

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


[PATCH 13/16] target/user: Convert to external tcmu_backend_dev_attrs

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch converts TCM-USER to use an external set of device attributes,
and utilizes target_core_backend_configfs.h macros to generate a default
set of configfs extended-attr handlers.

It calls target_core_setup_sub_cits() to setup the initial config_item_type
based on existing target_core_configfs.c defaults, and using configfs_attribute
generated by DEF_TB_DEFAULT_ATTRIBS(tcmu) populates tcmu_backend_dev_attrs[]

It introduces no function change for existing TCMU device attributes.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_user.c | 42 +++
 1 file changed, 42 insertions(+)

diff --git a/drivers/target/target_core_user.c 
b/drivers/target/target_core_user.c
index 9a1b314..8bfa61c 100644
--- a/drivers/target/target_core_user.c
+++ b/drivers/target/target_core_user.c
@@ -28,6 +28,8 @@
 #include target/target_core_base.h
 #include target/target_core_fabric.h
 #include target/target_core_backend.h
+#include target/target_core_backend_configfs.h
+
 #include linux/target_core_user.h
 
 /*
@@ -1092,6 +1094,42 @@ tcmu_parse_cdb(struct se_cmd *cmd)
return ret;
 }
 
+DEF_TB_DEFAULT_ATTRIBS(tcmu);
+
+static struct configfs_attribute *tcmu_backend_dev_attrs[] = {
+   tcmu_dev_attrib_emulate_model_alias.attr,
+   tcmu_dev_attrib_emulate_dpo.attr,
+   tcmu_dev_attrib_emulate_fua_write.attr,
+   tcmu_dev_attrib_emulate_fua_read.attr,
+   tcmu_dev_attrib_emulate_write_cache.attr,
+   tcmu_dev_attrib_emulate_ua_intlck_ctrl.attr,
+   tcmu_dev_attrib_emulate_tas.attr,
+   tcmu_dev_attrib_emulate_tpu.attr,
+   tcmu_dev_attrib_emulate_tpws.attr,
+   tcmu_dev_attrib_emulate_caw.attr,
+   tcmu_dev_attrib_emulate_3pc.attr,
+   tcmu_dev_attrib_pi_prot_type.attr,
+   tcmu_dev_attrib_hw_pi_prot_type.attr,
+   tcmu_dev_attrib_pi_prot_format.attr,
+   tcmu_dev_attrib_enforce_pr_isids.attr,
+   tcmu_dev_attrib_is_nonrot.attr,
+   tcmu_dev_attrib_emulate_rest_reord.attr,
+   tcmu_dev_attrib_force_pr_aptpl.attr,
+   tcmu_dev_attrib_hw_block_size.attr,
+   tcmu_dev_attrib_block_size.attr,
+   tcmu_dev_attrib_hw_max_sectors.attr,
+   tcmu_dev_attrib_fabric_max_sectors.attr,
+   tcmu_dev_attrib_optimal_sectors.attr,
+   tcmu_dev_attrib_hw_queue_depth.attr,
+   tcmu_dev_attrib_queue_depth.attr,
+   tcmu_dev_attrib_max_unmap_lba_count.attr,
+   tcmu_dev_attrib_max_unmap_block_desc_count.attr,
+   tcmu_dev_attrib_unmap_granularity.attr,
+   tcmu_dev_attrib_unmap_granularity_alignment.attr,
+   tcmu_dev_attrib_max_write_same_len.attr,
+   NULL,
+};
+
 static struct se_subsystem_api tcmu_template = {
.name   = user,
.inquiry_prod   = USER,
@@ -1112,6 +1150,7 @@ static struct se_subsystem_api tcmu_template = {
 
 static int __init tcmu_module_init(void)
 {
+   struct target_backend_cits *tbc = tcmu_template.tb_cits;
int ret;
 
BUILD_BUG_ON((sizeof(struct tcmu_cmd_entry) % TCMU_OP_ALIGN_SIZE) != 0);
@@ -1134,6 +1173,9 @@ static int __init tcmu_module_init(void)
goto out_unreg_device;
}
 
+   target_core_setup_sub_cits(tcmu_template);
+   tbc-tb_dev_attrib_cit.ct_attrs = tcmu_backend_dev_attrs;
+
ret = transport_subsystem_register(tcmu_template);
if (ret)
goto out_unreg_genl;
-- 
1.9.1

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


[PATCH 08/16] target: Add EXPORT_SYMBOL for existing se_dev_set_*

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

Now that target_core_backend_configfs.h macros will be using these
se_dev_set attribute functions externally to allow backend drivers
to populate different attributes, go ahead and add EXPORT_SYMBOL()
for the existing default set of 30 device attributes.

Also update target_core_backend.h with proper function prototypes.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_device.c   | 26 ++
 drivers/target/target_core_iblock.c   |  1 +
 drivers/target/target_core_internal.h | 28 
 include/target/target_core_backend.h  | 29 +
 4 files changed, 56 insertions(+), 28 deletions(-)

diff --git a/drivers/target/target_core_device.c 
b/drivers/target/target_core_device.c
index c45f9e9..953fff7 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -659,6 +659,7 @@ int se_dev_set_max_unmap_lba_count(
dev, dev-dev_attrib.max_unmap_lba_count);
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_max_unmap_lba_count);
 
 int se_dev_set_max_unmap_block_desc_count(
struct se_device *dev,
@@ -670,6 +671,7 @@ int se_dev_set_max_unmap_block_desc_count(
dev, dev-dev_attrib.max_unmap_block_desc_count);
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_max_unmap_block_desc_count);
 
 int se_dev_set_unmap_granularity(
struct se_device *dev,
@@ -680,6 +682,7 @@ int se_dev_set_unmap_granularity(
dev, dev-dev_attrib.unmap_granularity);
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_unmap_granularity);
 
 int se_dev_set_unmap_granularity_alignment(
struct se_device *dev,
@@ -690,6 +693,7 @@ int se_dev_set_unmap_granularity_alignment(
dev, dev-dev_attrib.unmap_granularity_alignment);
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_unmap_granularity_alignment);
 
 int se_dev_set_max_write_same_len(
struct se_device *dev,
@@ -700,6 +704,7 @@ int se_dev_set_max_write_same_len(
dev, dev-dev_attrib.max_write_same_len);
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_max_write_same_len);
 
 static void dev_set_t10_wwn_model_alias(struct se_device *dev)
 {
@@ -738,6 +743,7 @@ int se_dev_set_emulate_model_alias(struct se_device *dev, 
int flag)
 
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_emulate_model_alias);
 
 int se_dev_set_emulate_dpo(struct se_device *dev, int flag)
 {
@@ -753,6 +759,7 @@ int se_dev_set_emulate_dpo(struct se_device *dev, int flag)
 
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_emulate_dpo);
 
 int se_dev_set_emulate_fua_write(struct se_device *dev, int flag)
 {
@@ -771,6 +778,7 @@ int se_dev_set_emulate_fua_write(struct se_device *dev, int 
flag)
dev, dev-dev_attrib.emulate_fua_write);
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_emulate_fua_write);
 
 int se_dev_set_emulate_fua_read(struct se_device *dev, int flag)
 {
@@ -786,6 +794,7 @@ int se_dev_set_emulate_fua_read(struct se_device *dev, int 
flag)
 
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_emulate_fua_read);
 
 int se_dev_set_emulate_write_cache(struct se_device *dev, int flag)
 {
@@ -809,6 +818,7 @@ int se_dev_set_emulate_write_cache(struct se_device *dev, 
int flag)
dev, dev-dev_attrib.emulate_write_cache);
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_emulate_write_cache);
 
 int se_dev_set_emulate_ua_intlck_ctrl(struct se_device *dev, int flag)
 {
@@ -829,6 +839,7 @@ int se_dev_set_emulate_ua_intlck_ctrl(struct se_device 
*dev, int flag)
 
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_emulate_ua_intlck_ctrl);
 
 int se_dev_set_emulate_tas(struct se_device *dev, int flag)
 {
@@ -849,6 +860,7 @@ int se_dev_set_emulate_tas(struct se_device *dev, int flag)
 
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_emulate_tas);
 
 int se_dev_set_emulate_tpu(struct se_device *dev, int flag)
 {
@@ -870,6 +882,7 @@ int se_dev_set_emulate_tpu(struct se_device *dev, int flag)
dev, flag);
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_emulate_tpu);
 
 int se_dev_set_emulate_tpws(struct se_device *dev, int flag)
 {
@@ -891,6 +904,7 @@ int se_dev_set_emulate_tpws(struct se_device *dev, int flag)
dev, flag);
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_emulate_tpws);
 
 int se_dev_set_emulate_caw(struct se_device *dev, int flag)
 {
@@ -904,6 +918,7 @@ int se_dev_set_emulate_caw(struct se_device *dev, int flag)
 
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_emulate_caw);
 
 int se_dev_set_emulate_3pc(struct se_device *dev, int flag)
 {
@@ -917,6 +932,7 @@ int se_dev_set_emulate_3pc(struct se_device *dev, int flag)
 
return 0;
 }
+EXPORT_SYMBOL(se_dev_set_emulate_3pc);
 
 int se_dev_set_pi_prot_type(struct se_device *dev, int flag)
 {
@@ -970,6 +986,7 @@ int se_dev_set_pi_prot_type(struct se_device *dev, 

[PATCH 07/16] target: Add target_core_backend_configfs.h helper macros

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch adds a number of configfs e-attr macros following
what existing target_core_configfs.c code does for internal
target_backend_dev_attrib setup, and similar to how target
fabric drivers allow for external config_item_type + cit-ct_attrs.
assignment.

This is useful for backend drivers like PSCSI who need to only
expose a small subset of device attributes, while still retaining
a default list of attributes for other backend drivers like
IBLOCK, FILEIO, RAMDISK, and TCMU.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 include/target/target_core_backend_configfs.h | 53 +++
 1 file changed, 53 insertions(+)
 create mode 100644 include/target/target_core_backend_configfs.h

diff --git a/include/target/target_core_backend_configfs.h 
b/include/target/target_core_backend_configfs.h
new file mode 100644
index 000..f91935b
--- /dev/null
+++ b/include/target/target_core_backend_configfs.h
@@ -0,0 +1,53 @@
+#ifndef TARGET_CORE_BACKEND_CONFIGFS_H
+#define TARGET_CORE_BACKEND_CONFIGFS_H
+
+#include target/configfs_macros.h
+
+#define DEF_TB_DEV_ATTRIB_SHOW(_backend, _name)
\
+static ssize_t _backend##_dev_show_attr_##_name(   \
+   struct se_dev_attrib *da,   \
+   char *page) \
+{  \
+   return snprintf(page, PAGE_SIZE, %u\n,\
+   (u32)da-da_dev-dev_attrib._name); \
+}
+
+#define DEF_TB_DEV_ATTRIB_STORE(_backend, _name)   \
+static ssize_t _backend##_dev_store_attr_##_name(  \
+   struct se_dev_attrib *da,   \
+   const char *page,   \
+   size_t count)   \
+{  \
+   unsigned long val;  \
+   int ret;\
+   \
+   ret = kstrtoul(page, 0, val);  \
+   if (ret  0) {  \
+   pr_err(kstrtoul() failed with ret: %d\n, ret);\
+   return -EINVAL; \
+   }   \
+   ret = se_dev_set_##_name(da-da_dev, (u32)val); \
+   \
+   return (!ret) ? count : -EINVAL;\
+}
+
+#define DEF_TB_DEV_ATTRIB(_backend, _name) \
+DEF_TB_DEV_ATTRIB_SHOW(_backend, _name);   \
+DEF_TB_DEV_ATTRIB_STORE(_backend, _name);
+
+#define DEF_TB_DEV_ATTRIB_RO(_backend, name)   \
+DEF_TB_DEV_ATTRIB_SHOW(_backend, name);
+
+CONFIGFS_EATTR_STRUCT(target_backend_dev_attrib, se_dev_attrib);
+#define TB_DEV_ATTR(_backend, _name, _mode)\
+static struct target_backend_dev_attrib_attribute 
_backend##_dev_attrib_##_name = \
+   __CONFIGFS_EATTR(_name, _mode,  \
+   _backend##_dev_show_attr_##_name,   \
+   _backend##_dev_store_attr_##_name);
+
+#define TB_DEV_ATTR_RO(_backend, _name)
\
+static struct target_backend_dev_attrib_attribute 
_backend##_dev_attrib_##_name = \
+   __CONFIGFS_EATTR_RO(_name,  \
+   _backend##_dev_show_attr_##_name);
+
+#endif /* TARGET_CORE_BACKEND_CONFIGFS_H */
-- 
1.9.1

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


[PATCH 06/16] target: Move dev_stat_cit to struct se_subsystem_api

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This patch adds support for dev_stat_cit as an external config_item_type
using TB_CIT_SETUP() helper macro, and sets only ct_group_ops following
existing code.

It updates target_core_make_subdev() + target_core_setup_dev_attrib_cit() +
struct target_backend_cits, and drops left-over target_core_dev_stat_cit
from target_core_configfs.c code and update comments.

This patch introduces no functional change from existing code.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 drivers/target/target_core_configfs.c | 12 +---
 include/target/target_core_backend.h  |  1 +
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/target/target_core_configfs.c 
b/drivers/target/target_core_configfs.c
index 0cf41ad..2903d89 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -2748,7 +2748,7 @@ static struct config_item_type target_core_alua_cit = {
 
 /* End functions for struct config_item_type target_core_alua_cit */
 
-/* Start functions for struct config_item_type target_core_stat_cit */
+/* Start functions for struct config_item_type tb_dev_stat_cit */
 
 static struct config_group *target_core_stat_mkdir(
struct config_group *group,
@@ -2769,12 +2769,9 @@ static struct configfs_group_operations 
target_core_stat_group_ops = {
.drop_item  = target_core_stat_rmdir,
 };
 
-static struct config_item_type target_core_stat_cit = {
-   .ct_group_ops   = target_core_stat_group_ops,
-   .ct_owner   = THIS_MODULE,
-};
+TB_CIT_SETUP(dev_stat, NULL, target_core_stat_group_ops, NULL);
 
-/* End functions for struct config_item_type target_core_stat_cit */
+/* End functions for struct config_item_type tb_dev_stat_cit */
 
 /* Start functions for struct config_item_type target_core_hba_cit */
 
@@ -2820,7 +2817,7 @@ static struct config_group *target_core_make_subdev(
config_group_init_type_name(dev-t10_alua.alua_tg_pt_gps_group,
alua, t-tb_cits.tb_dev_alua_tg_pt_gps_cit);
config_group_init_type_name(dev-dev_stat_grps.stat_group,
-   statistics, target_core_stat_cit);
+   statistics, t-tb_cits.tb_dev_stat_cit);
 
dev_cg-default_groups[0] = dev-dev_attrib.da_group;
dev_cg-default_groups[1] = dev-dev_pr_group;
@@ -3121,6 +3118,7 @@ void target_core_setup_sub_cits(struct se_subsystem_api 
*sa)
target_core_setup_dev_pr_cit(sa);
target_core_setup_dev_wwn_cit(sa);
target_core_setup_dev_alua_tg_pt_gps_cit(sa);
+   target_core_setup_dev_stat_cit(sa);
 }
 EXPORT_SYMBOL(target_core_setup_sub_cits);
 
diff --git a/include/target/target_core_backend.h 
b/include/target/target_core_backend.h
index 157d173..83a3726 100644
--- a/include/target/target_core_backend.h
+++ b/include/target/target_core_backend.h
@@ -11,6 +11,7 @@ struct target_backend_cits {
struct config_item_type tb_dev_pr_cit;
struct config_item_type tb_dev_wwn_cit;
struct config_item_type tb_dev_alua_tg_pt_gps_cit;
+   struct config_item_type tb_dev_stat_cit;
 };
 
 struct se_subsystem_api {
-- 
1.9.1

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


[PATCH 09/16] target: Add DEF_TB_DEFAULT_ATTRIBS macro for virtual device attrs

2014-11-28 Thread Nicholas A. Bellinger
From: Nicholas Bellinger n...@linux-iscsi.org

This helper macro adds the default set of 30 device attributes for
virtual devices from existing target_core_configfs.c code, and moves
the definitions into a single macro to create the structs necessary
for backend drivers.

It allows them to populate their own external struct configfs_attribute
for se_subsystem_api-tb_cits.tb_dev_attrib_cit.ct_attrs.

Signed-off-by: Nicholas Bellinger n...@linux-iscsi.org
---
 include/target/target_core_backend_configfs.h | 67 +++
 1 file changed, 67 insertions(+)

diff --git a/include/target/target_core_backend_configfs.h 
b/include/target/target_core_backend_configfs.h
index f91935b..3247d75 100644
--- a/include/target/target_core_backend_configfs.h
+++ b/include/target/target_core_backend_configfs.h
@@ -50,4 +50,71 @@ static struct target_backend_dev_attrib_attribute 
_backend##_dev_attrib_##_name
__CONFIGFS_EATTR_RO(_name,  \
_backend##_dev_show_attr_##_name);
 
+/*
+ * Default list of target backend device attributes as defined by
+ * struct se_dev_attrib
+ */
+
+#define DEF_TB_DEFAULT_ATTRIBS(_backend)   \
+   DEF_TB_DEV_ATTRIB(_backend, emulate_model_alias);   \
+   TB_DEV_ATTR(_backend, emulate_model_alias, S_IRUGO | S_IWUSR);  \
+   DEF_TB_DEV_ATTRIB(_backend, emulate_dpo);   \
+   TB_DEV_ATTR(_backend, emulate_dpo, S_IRUGO | S_IWUSR);  \
+   DEF_TB_DEV_ATTRIB(_backend, emulate_fua_write); \
+   TB_DEV_ATTR(_backend, emulate_fua_write, S_IRUGO | S_IWUSR);\
+   DEF_TB_DEV_ATTRIB(_backend, emulate_fua_read);  \
+   TB_DEV_ATTR(_backend, emulate_fua_read, S_IRUGO | S_IWUSR); \
+   DEF_TB_DEV_ATTRIB(_backend, emulate_write_cache);   \
+   TB_DEV_ATTR(_backend, emulate_write_cache, S_IRUGO | S_IWUSR);  \
+   DEF_TB_DEV_ATTRIB(_backend, emulate_ua_intlck_ctrl);\
+   TB_DEV_ATTR(_backend, emulate_ua_intlck_ctrl, S_IRUGO | S_IWUSR); \
+   DEF_TB_DEV_ATTRIB(_backend, emulate_tas);   \
+   TB_DEV_ATTR(_backend, emulate_tas, S_IRUGO | S_IWUSR);  \
+   DEF_TB_DEV_ATTRIB(_backend, emulate_tpu);   \
+   TB_DEV_ATTR(_backend, emulate_tpu, S_IRUGO | S_IWUSR);  \
+   DEF_TB_DEV_ATTRIB(_backend, emulate_tpws);  \
+   TB_DEV_ATTR(_backend, emulate_tpws, S_IRUGO | S_IWUSR); \
+   DEF_TB_DEV_ATTRIB(_backend, emulate_caw);   \
+   TB_DEV_ATTR(_backend, emulate_caw, S_IRUGO | S_IWUSR);  \
+   DEF_TB_DEV_ATTRIB(_backend, emulate_3pc);   \
+   TB_DEV_ATTR(_backend, emulate_3pc, S_IRUGO | S_IWUSR);  \
+   DEF_TB_DEV_ATTRIB(_backend, pi_prot_type);  \
+   TB_DEV_ATTR(_backend, pi_prot_type, S_IRUGO | S_IWUSR); \
+   DEF_TB_DEV_ATTRIB_RO(_backend, hw_pi_prot_type);\
+   TB_DEV_ATTR_RO(_backend, hw_pi_prot_type);  \
+   DEF_TB_DEV_ATTRIB(_backend, pi_prot_format);\
+   TB_DEV_ATTR(_backend, pi_prot_format, S_IRUGO | S_IWUSR);   \
+   DEF_TB_DEV_ATTRIB(_backend, enforce_pr_isids);  \
+   TB_DEV_ATTR(_backend, enforce_pr_isids, S_IRUGO | S_IWUSR); \
+   DEF_TB_DEV_ATTRIB(_backend, is_nonrot); \
+   TB_DEV_ATTR(_backend, is_nonrot, S_IRUGO | S_IWUSR);\
+   DEF_TB_DEV_ATTRIB(_backend, emulate_rest_reord);\
+   TB_DEV_ATTR(_backend, emulate_rest_reord, S_IRUGO | S_IWUSR);   \
+   DEF_TB_DEV_ATTRIB(_backend, force_pr_aptpl);\
+   TB_DEV_ATTR(_backend, force_pr_aptpl, S_IRUGO | S_IWUSR);   \
+   DEF_TB_DEV_ATTRIB_RO(_backend, hw_block_size);  \
+   TB_DEV_ATTR_RO(_backend, hw_block_size);\
+   DEF_TB_DEV_ATTRIB(_backend, block_size);\
+   TB_DEV_ATTR(_backend, block_size, S_IRUGO | S_IWUSR);   \
+   DEF_TB_DEV_ATTRIB_RO(_backend, hw_max_sectors); \
+   TB_DEV_ATTR_RO(_backend, hw_max_sectors);   \
+   DEF_TB_DEV_ATTRIB(_backend, fabric_max_sectors);\
+   TB_DEV_ATTR(_backend, fabric_max_sectors, S_IRUGO | S_IWUSR);   \
+   DEF_TB_DEV_ATTRIB(_backend, optimal_sectors);   \
+   TB_DEV_ATTR(_backend, optimal_sectors, S_IRUGO | S_IWUSR);  \
+   DEF_TB_DEV_ATTRIB_RO(_backend, hw_queue_depth); \
+   TB_DEV_ATTR_RO(_backend, hw_queue_depth);   \
+   DEF_TB_DEV_ATTRIB(_backend, queue_depth);   \
+   TB_DEV_ATTR(_backend, queue_depth, S_IRUGO | S_IWUSR);  \
+   DEF_TB_DEV_ATTRIB(_backend, max_unmap_lba_count);   \
+   

Re: [PATCH 1/1] arcmsr: Notify has sense data report

2014-11-28 Thread Ching Huang
Thanks to Dan's advice and Hannes' suggestion.
I will revise and resubmit it later.

On Fri, 2014-11-28 at 12:17 +0300, Dan Carpenter wrote:
 On Fri, Nov 28, 2014 at 12:20:44PM +0800, Ching Huang wrote:
  This patch is relative to 
  http://git.infradead.org/users/hch/scsi-queue.git/tree/refs/heads/drivers-for-3.18:/drivers/scsi/arcmsr
  
 
 Put this information after the --- cut off line so that it is not
 saved in the permanent git log.
 
  Setting command status with 'DRIVER_SENSE' except 'CHECK_CONDITION' if we 
  have sense data.
  
  Signed-off-by: Ching Huang ching2...@areca.com.tw
  ---
 
 --- Here.  Put it here.
 
  
  diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
  --- a/drivers/scsi/arcmsr/arcmsr.h  2014-09-19 11:04:41.84510 +0800
  +++ b/drivers/scsi/arcmsr/arcmsr.h  2014-11-28 10:54:30.0 +0800
  @@ -52,7 +52,7 @@ struct device_attribute;
  #define ARCMSR_MAX_FREECCB_NUM  320
   #define ARCMSR_MAX_OUTSTANDING_CMD 255
 
 regards,
 dan carpenter
 


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


[PATCH 1.1 1/1] arcmsr: Notify has sense data report

2014-11-28 Thread Ching Huang
From: Ching Huang ching2...@areca.com.tw

Setting command status with 'DRIVER_SENSE' except 'CHECK_CONDITION' if we have 
sense data.

Signed-off-by: Ching Huang ching2...@areca.com.tw
---

This patch is relative to 
http://git.infradead.org/users/hch/scsi-queue.git/tree/refs/heads/drivers-for-3.18:/drivers/scsi/arcmsr


diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
--- a/drivers/scsi/arcmsr/arcmsr.h  2014-09-19 11:04:41.84510 +0800
+++ b/drivers/scsi/arcmsr/arcmsr.h  2014-11-28 10:54:30.0 +0800
@@ -52,7 +52,7 @@ struct device_attribute;
#define ARCMSR_MAX_FREECCB_NUM  320
 #define ARCMSR_MAX_OUTSTANDING_CMD 255
 #endif
-#define ARCMSR_DRIVER_VERSION  v1.30.00.04-20140919
+#define ARCMSR_DRIVER_VERSION  v1.30.00.05-20141128
 #define ARCMSR_SCSI_INITIATOR_ID   
255
 #define ARCMSR_MAX_XFER_SECTORS
512
 #define ARCMSR_MAX_XFER_SECTORS_B  
4096
diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
--- a/drivers/scsi/arcmsr/arcmsr_hba.c  2014-09-19 11:01:26.99009 +0800
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c  2014-11-28 17:51:04.0 +0800
@@ -989,16 +989,15 @@ static void arcmsr_report_sense_info(str
 
struct scsi_cmnd *pcmd = ccb-pcmd;
struct SENSE_DATA *sensebuffer = (struct SENSE_DATA 
*)pcmd-sense_buffer;
-   pcmd-result = DID_OK  16;
-   if (sensebuffer) {
-   int sense_data_length =
+
+   pcmd-result = (DRIVER_SENSE  24) | (DID_OK  16) | (CHECK_CONDITION 
 1);
+   int sense_data_length =
sizeof(struct SENSE_DATA)  SCSI_SENSE_BUFFERSIZE
? sizeof(struct SENSE_DATA) : SCSI_SENSE_BUFFERSIZE;
-   memset(sensebuffer, 0, SCSI_SENSE_BUFFERSIZE);
-   memcpy(sensebuffer, ccb-arcmsr_cdb.SenseData, 
sense_data_length);
-   sensebuffer-ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
-   sensebuffer-Valid = 1;
-   }
+   memset(sensebuffer, 0, SCSI_SENSE_BUFFERSIZE);
+   memcpy(sensebuffer, ccb-arcmsr_cdb.SenseData, sense_data_length);
+   sensebuffer-ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
+   sensebuffer-Valid = 1;
 }
 
 static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb)


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


Re: [PATCH 1.1 1/1] arcmsr: Notify has sense data report

2014-11-28 Thread Hannes Reinecke
On 11/28/2014 11:07 AM, Ching Huang wrote:
 From: Ching Huang ching2...@areca.com.tw
 
 Setting command status with 'DRIVER_SENSE' except 'CHECK_CONDITION' if we 
 have sense data.
 
 Signed-off-by: Ching Huang ching2...@areca.com.tw
 ---
 
 This patch is relative to 
 http://git.infradead.org/users/hch/scsi-queue.git/tree/refs/heads/drivers-for-3.18:/drivers/scsi/arcmsr
 
 
 diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
 --- a/drivers/scsi/arcmsr/arcmsr.h2014-09-19 11:04:41.84510 +0800
 +++ b/drivers/scsi/arcmsr/arcmsr.h2014-11-28 10:54:30.0 +0800
 @@ -52,7 +52,7 @@ struct device_attribute;
   #define ARCMSR_MAX_FREECCB_NUM  320
  #define ARCMSR_MAX_OUTSTANDING_CMD   255
  #endif
 -#define ARCMSR_DRIVER_VERSIONv1.30.00.04-20140919
 +#define ARCMSR_DRIVER_VERSIONv1.30.00.05-20141128
  #define ARCMSR_SCSI_INITIATOR_ID 
 255
  #define ARCMSR_MAX_XFER_SECTORS  
 512
  #define ARCMSR_MAX_XFER_SECTORS_B
 4096
 diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c 
 b/drivers/scsi/arcmsr/arcmsr_hba.c
 --- a/drivers/scsi/arcmsr/arcmsr_hba.c2014-09-19 11:01:26.99009 
 +0800
 +++ b/drivers/scsi/arcmsr/arcmsr_hba.c2014-11-28 17:51:04.0 
 +0800
 @@ -989,16 +989,15 @@ static void arcmsr_report_sense_info(str
  
   struct scsi_cmnd *pcmd = ccb-pcmd;
   struct SENSE_DATA *sensebuffer = (struct SENSE_DATA 
 *)pcmd-sense_buffer;
 - pcmd-result = DID_OK  16;
 - if (sensebuffer) {
 - int sense_data_length =
 +
 + pcmd-result = (DRIVER_SENSE  24) | (DID_OK  16) | (CHECK_CONDITION 
  1);
 + int sense_data_length =
   sizeof(struct SENSE_DATA)  SCSI_SENSE_BUFFERSIZE
   ? sizeof(struct SENSE_DATA) : SCSI_SENSE_BUFFERSIZE;
 - memset(sensebuffer, 0, SCSI_SENSE_BUFFERSIZE);
 - memcpy(sensebuffer, ccb-arcmsr_cdb.SenseData, 
 sense_data_length);
 - sensebuffer-ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
 - sensebuffer-Valid = 1;
 - }
 + memset(sensebuffer, 0, SCSI_SENSE_BUFFERSIZE);
 + memcpy(sensebuffer, ccb-arcmsr_cdb.SenseData, sense_data_length);
 + sensebuffer-ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
 + sensebuffer-Valid = 1;
  }
  
  static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb)
 
 
Hmm. Sorry to be picky, but:

Is there a chance the _no_ sense data will be provided?
If so we'd end up starting the error handler, calling REQUEST SENSE
(which will fail, too), and finally offlining the device.
I'd rather provide a default sense code for these cases.

Plus please use SAM_STAT_CHECK_CONDITION instead of
CHECK_CONDITION  1.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries  Storage
h...@suse.de  +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] scsi: never drop to untagged mode during queue ramp down

2014-11-28 Thread Bart Van Assche

On 11/24/14 15:36, Christoph Hellwig wrote:

Dropping to untagged mode when ramping down a queue due to QUEUE FULL
events has two problems:

  - nothing in the midlayer or drivers ever moves back to tagged mode
during queue ramp up.
  - cmd_per_lun isn't the untagged queue depth for many modern drivers
that can handle multiple untagged commands, and this is the only
place in the midlayer assuming that.


Reviewed-by: Bart Van Assche bvanass...@acm.org

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


Re: [PATCH 4/4] scsi: remove scsi_set_tag_type

2014-11-28 Thread Bart Van Assche

On 11/24/14 15:36, Christoph Hellwig wrote:

There is no benefit over just setting sdev-simple_tags directly.


Reviewed-by: Bart Van Assche bvanass...@acm.org

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


Re: [PATCH 3/4] scsi: remove scsi_get_tag_type

2014-11-28 Thread Bart Van Assche

On 11/24/14 15:36, Christoph Hellwig wrote:

Both remaining users are better of just checking sdev-simple_tags
directly.


Reviewed-by: Bart Van Assche bvanass...@acm.org

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


Re: [PATCH 1.1 1/1] arcmsr: Notify has sense data report

2014-11-28 Thread 黃清隆
There is no this case.
We always have auto request sense to device in case of CHECK_CONDITION status.

2014-11-28 18:14 GMT+08:00 Hannes Reinecke h...@suse.de:
 On 11/28/2014 11:07 AM, Ching Huang wrote:
 From: Ching Huang ching2...@areca.com.tw

 Setting command status with 'DRIVER_SENSE' except 'CHECK_CONDITION' if we 
 have sense data.

 Signed-off-by: Ching Huang ching2...@areca.com.tw
 ---

 This patch is relative to 
 http://git.infradead.org/users/hch/scsi-queue.git/tree/refs/heads/drivers-for-3.18:/drivers/scsi/arcmsr


 diff -uprN a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
 --- a/drivers/scsi/arcmsr/arcmsr.h2014-09-19 11:04:41.84510 +0800
 +++ b/drivers/scsi/arcmsr/arcmsr.h2014-11-28 10:54:30.0 +0800
 @@ -52,7 +52,7 @@ struct device_attribute;
   #define ARCMSR_MAX_FREECCB_NUM  320
  #define ARCMSR_MAX_OUTSTANDING_CMD   255
  #endif
 -#define ARCMSR_DRIVER_VERSIONv1.30.00.04-20140919
 +#define ARCMSR_DRIVER_VERSIONv1.30.00.05-20141128
  #define ARCMSR_SCSI_INITIATOR_ID
  255
  #define ARCMSR_MAX_XFER_SECTORS 
  512
  #define ARCMSR_MAX_XFER_SECTORS_B   
  4096
 diff -uprN a/drivers/scsi/arcmsr/arcmsr_hba.c 
 b/drivers/scsi/arcmsr/arcmsr_hba.c
 --- a/drivers/scsi/arcmsr/arcmsr_hba.c2014-09-19 11:01:26.99009 
 +0800
 +++ b/drivers/scsi/arcmsr/arcmsr_hba.c2014-11-28 17:51:04.0 
 +0800
 @@ -989,16 +989,15 @@ static void arcmsr_report_sense_info(str

   struct scsi_cmnd *pcmd = ccb-pcmd;
   struct SENSE_DATA *sensebuffer = (struct SENSE_DATA 
 *)pcmd-sense_buffer;
 - pcmd-result = DID_OK  16;
 - if (sensebuffer) {
 - int sense_data_length =
 +
 + pcmd-result = (DRIVER_SENSE  24) | (DID_OK  16) | 
 (CHECK_CONDITION  1);
 + int sense_data_length =
   sizeof(struct SENSE_DATA)  SCSI_SENSE_BUFFERSIZE
   ? sizeof(struct SENSE_DATA) : SCSI_SENSE_BUFFERSIZE;
 - memset(sensebuffer, 0, SCSI_SENSE_BUFFERSIZE);
 - memcpy(sensebuffer, ccb-arcmsr_cdb.SenseData, 
 sense_data_length);
 - sensebuffer-ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
 - sensebuffer-Valid = 1;
 - }
 + memset(sensebuffer, 0, SCSI_SENSE_BUFFERSIZE);
 + memcpy(sensebuffer, ccb-arcmsr_cdb.SenseData, sense_data_length);
 + sensebuffer-ErrorCode = SCSI_SENSE_CURRENT_ERRORS;
 + sensebuffer-Valid = 1;
  }

  static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb)


 Hmm. Sorry to be picky, but:

 Is there a chance the _no_ sense data will be provided?
 If so we'd end up starting the error handler, calling REQUEST SENSE
 (which will fail, too), and finally offlining the device.
 I'd rather provide a default sense code for these cases.

 Plus please use SAM_STAT_CHECK_CONDITION instead of
 CHECK_CONDITION  1.

 Cheers,

 Hannes
 --
 Dr. Hannes Reinecke   zSeries  Storage
 h...@suse.de  +49 911 74053 688
 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
 GF: J. Hawn, J. Guild, F. Imendörffer, HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/4] scsi: remove MSG_*_TAG defines

2014-11-28 Thread Bart Van Assche

On 11/24/14 16:07, Christoph Hellwig wrote:

index 6719a33..2c5ce48 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -7921,9 +7921,9 @@ static int asc_build_req(struct asc_board *boardp, struct 
scsi_cmnd *scp,
 */
if ((asc_dvc-cur_dvc_qng[scp-device-id]  0) 
(boardp-reqcnt[scp-device-id] % 255) == 0) {
-   asc_scsi_q-q2.tag_code = MSG_ORDERED_TAG;
+   asc_scsi_q-q2.tag_code = ORDERED_QUEUE_TAG;
} else {
-   asc_scsi_q-q2.tag_code = MSG_SIMPLE_TAG;
+   asc_scsi_q-q2.tag_code = SIMPLE_QUEUE_TAG;
}

/* Build ASC_SCSI_Q */
@@ -8351,7 +8351,7 @@ static int AscPutReadyQueue(ASC_DVC_VAR *asc_dvc, 
ASC_SCSI_Q *scsiq, uchar q_no)
}
q_addr = ASC_QNO_TO_QADDR(q_no);
if ((scsiq-q1.target_id  asc_dvc-use_tagged_qng) == 0) {
-   scsiq-q2.tag_code = ~MSG_SIMPLE_TAG;
+   scsiq-q2.tag_code = ~SIMPLE_QUEUE_TAG;
}
scsiq-q1.status = QS_FREE;
AscMemWordCopyPtrToLram(iop_base,
@@ -8669,7 +8669,7 @@ static int AscExeScsiQueue(ASC_DVC_VAR *asc_dvc, 
ASC_SCSI_Q *scsiq)
}
}
if (disable_syn_offset_one_fix) {
-   scsiq-q2.tag_code = ~MSG_SIMPLE_TAG;
+   scsiq-q2.tag_code = ~SIMPLE_QUEUE_TAG;
scsiq-q2.tag_code |= (ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX |
   ASC_TAG_FLAG_DISABLE_DISCONNECT);
} else {


One of the statements in advansys.c (tag_code = 0xDC) makes assumptions 
about the numeric value of MSG_SIMPLE_TAG. This makes me wonder whether 
it is safe to change MSG_SIMPLE_TAG into another value ?


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


Re: [PATCH 1/4] scsi: remove -change_queue_type method

2014-11-28 Thread Bart Van Assche

On 11/24/14 15:36, Christoph Hellwig wrote:

Since we got rid of ordered tag support in 2010 the prime use case of
switching on and off ordered tags has been obsolete.  The other function
of enabling/dsiabling tagging entirely has only been correctly implemented
by the 53c700 driver and isn't generally useful.


Reviewed-by: Bart Van Assche bvanass...@acm.org

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


Re: [PATCH] scsi_debug: improve driver description in Kconfig

2014-11-28 Thread Randy Dunlap
On 11/26/14 11:55, Douglas Gilbert wrote:
 From: Douglas Gilbert dgilb...@interlog.com
 Date: Wed, 26 Nov 2014 14:41:55 -0500
 Subject: [PATCH] scsi_debug improve driver description in Kconfig
 
 Try to give a more accurate driver description and some extra
 useful information in less lines.
 ---
  drivers/scsi/Kconfig | 17 -
  1 file changed, 8 insertions(+), 9 deletions(-)
 
 Signed-off-by: Douglas Gilbert dgilb...@interlog.com
 

creating a small ram disk device.

I would say: RAM

Otherwise looks good to me.

-- 
~Randy
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi_debug: improve driver description in Kconfig

2014-11-28 Thread Douglas Gilbert

On 14-11-28 04:05 PM, Randy Dunlap wrote:

On 11/26/14 11:55, Douglas Gilbert wrote:

From: Douglas Gilbert dgilb...@interlog.com
Date: Wed, 26 Nov 2014 14:41:55 -0500
Subject: [PATCH] scsi_debug improve driver description in Kconfig

Try to give a more accurate driver description and some extra
useful information in less lines.
---
  drivers/scsi/Kconfig | 17 -
  1 file changed, 8 insertions(+), 9 deletions(-)

Signed-off-by: Douglas Gilbert dgilb...@interlog.com



creating a small ram disk device.

I would say: RAM

Otherwise looks good to me.


Okay, version 2 attached.

From: Douglas Gilbert dgilb...@interlog.com
Date: Fri, 28 Nov 2014 19:03:21 -0500
Subject: [PATCH] scsi_debug improve driver description in Kconfig

Try to give a more accurate driver description and some extra
information in less lines.
---
 drivers/scsi/Kconfig | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

Signed-off-by: Douglas Gilbert dgilb...@interlog.com

From 9d735409215bb44fdec1dcf0cbe4acf7bd05021f Mon Sep 17 00:00:00 2001
From: Douglas Gilbert dgilb...@interlog.com
Date: Fri, 28 Nov 2014 19:03:21 -0500
Subject: [PATCH] scsi_debug improve driver description in Kconfig

Try to give a more accurate driver description and some extra
information in less lines.
---
 drivers/scsi/Kconfig | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 86cf3d6..9c92f41 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1462,18 +1462,17 @@ config SCSI_WD719X
 	  SCSI controllers (based on WD33C296A chip).
 
 config SCSI_DEBUG
-	tristate SCSI debugging host simulator
+	tristate SCSI debugging host and device simulator
 	depends on SCSI
 	select CRC_T10DIF
 	help
-	  This is a host adapter simulator that can simulate multiple hosts
-	  each with multiple dummy SCSI devices (disks). It defaults to one
-	  host adapter with one dummy SCSI disk. Each dummy disk uses kernel
-	  RAM as storage (i.e. it is a ramdisk). To save space when multiple
-	  dummy disks are simulated, they share the same kernel RAM for 
-	  their storage. See http://sg.danny.cz/sg/sdebug26.html for more
-	  information. This driver is primarily of use to those testing the
-	  SCSI and block subsystems. If unsure, say N.
+	  This pseudo driver simulates one or more hosts (SCSI initiators),
+	  each with one or more targets, each with one or more logical units.
+	  Defaults to one of each, creating a small RAM disk device. Many
+	  parameters found in the /sys/bus/pseudo/drivers/scsi_debug
+	  directory can be tweaked at run time.
+	  See http://sg.danny.cz/sg/sdebug26.html for more information.
+	  Mainly used for testing and best as a module. If unsure, say N.
 
 config SCSI_MESH
 	tristate MESH (Power Mac internal SCSI) support
-- 
1.9.1



[PATCH 0/7] scsi: Some seq_file cleanups/optimizations

2014-11-28 Thread Rasmus Villemoes
These patches mostly replace seq_printf with simpler and faster
equivalents, e.g. seq_printf(m, something) = seq_puts(m,
something) and seq_printf(m, \n) = seq_putc(m, '\n). But before
my Coccinelle scripts could be unleashed I had to clean up some
unnecessary, and in the PRINTP case quite obfuscating, macros.

The patches don't change the semantics of the code (well, that's the
idea anyway), but should make it slightly smaller and faster.

Rasmus Villemoes (7):
  scsi: Remove SPRINTF macro
  scsi/g_NCR5380: Remove obfuscating macros
  scsi/advansys: Replace seq_printf with seq_puts
  scsi/aha152x: Replace seq_printf with seq_puts
  scsi: misc:  Replace seq_printf with seq_puts
  scsi: misc: Merge consecutive seq_puts calls
  scsi: misc: Print single-character strings with seq_putc

 drivers/scsi/BusLogic.c |  10 +-
 drivers/scsi/NCR5380.c  |  42 +++--
 drivers/scsi/advansys.c | 145 -
 drivers/scsi/aha152x.c  | 301 ++--
 drivers/scsi/aic7xxx/aic79xx_proc.c |  38 +++--
 drivers/scsi/aic7xxx/aic7xxx_proc.c |  24 +--
 drivers/scsi/arm/fas216.c   |   6 +-
 drivers/scsi/atari_NCR5380.c|   4 +-
 drivers/scsi/atp870u.c  |   5 +-
 drivers/scsi/dc395x.c   |  78 +-
 drivers/scsi/dpt_i2o.c  |   2 +-
 drivers/scsi/eata_pio.c |   2 +-
 drivers/scsi/esas2r/esas2r_main.c   |   2 +-
 drivers/scsi/g_NCR5380.c|  66 
 drivers/scsi/gdth_proc.c|  24 +--
 drivers/scsi/in2000.c   |  18 +--
 drivers/scsi/ips.c  |   7 +-
 drivers/scsi/megaraid.c |   2 +-
 drivers/scsi/nsp32.c|  41 +++--
 drivers/scsi/pcmcia/nsp_cs.c|  50 +++---
 drivers/scsi/qla2xxx/qla_dfs.c  |   8 +-
 drivers/scsi/scsi_proc.c|  22 +--
 drivers/scsi/scsi_trace.c   |   6 +-
 drivers/scsi/sun3_NCR5380.c |   4 +-
 drivers/scsi/wd33c93.c  |  18 +--
 drivers/scsi/wd7000.c   |  41 +++--
 26 files changed, 460 insertions(+), 506 deletions(-)

-- 
2.0.4

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


[PATCH 1/7] scsi: Remove SPRINTF macro

2014-11-28 Thread Rasmus Villemoes
The macro SPRINTF doesn't save a lot of typing or make the code more
readable, and depending on a specific identifier (m) in the
surrounding scope is generally frowned upon. Nuke it.

Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk
---
 drivers/scsi/NCR5380.c   |  42 +++---
 drivers/scsi/aha152x.c   | 301 +--
 drivers/scsi/dc395x.c|  78 ++-
 drivers/scsi/nsp32.c |  41 +++---
 drivers/scsi/pcmcia/nsp_cs.c |  50 ---
 drivers/scsi/wd7000.c|  41 +++---
 6 files changed, 266 insertions(+), 287 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 45da3c8..8395930 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -698,8 +698,6 @@ static int __maybe_unused NCR5380_write_info(struct 
Scsi_Host *instance,
return (-ENOSYS);   /* Currently this is a no-op */
 }
 
-#undef SPRINTF
-#define SPRINTF(args...) seq_printf(m, ## args)
 static
 void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m);
 static
@@ -715,45 +713,45 @@ static int __maybe_unused NCR5380_show_info(struct 
seq_file *m,
 
hostdata = (struct NCR5380_hostdata *) instance-hostdata;
 
-   SPRINTF(NCR5380 core release=%d.   , NCR5380_PUBLIC_RELEASE);
+   seq_printf(m, NCR5380 core release=%d.   , NCR5380_PUBLIC_RELEASE);
if (((struct NCR5380_hostdata *) instance-hostdata)-flags  
FLAG_NCR53C400)
-   SPRINTF(ncr53c400 release=%d.  , NCR53C400_PUBLIC_RELEASE);
+   seq_printf(m, ncr53c400 release=%d.  , 
NCR53C400_PUBLIC_RELEASE);
 #ifdef DTC_PUBLIC_RELEASE
-   SPRINTF(DTC 3180/3280 release %d, DTC_PUBLIC_RELEASE);
+   seq_printf(m, DTC 3180/3280 release %d, DTC_PUBLIC_RELEASE);
 #endif
 #ifdef T128_PUBLIC_RELEASE
-   SPRINTF(T128 release %d, T128_PUBLIC_RELEASE);
+   seq_printf(m, T128 release %d, T128_PUBLIC_RELEASE);
 #endif
 #ifdef GENERIC_NCR5380_PUBLIC_RELEASE
-   SPRINTF(Generic5380 release %d, GENERIC_NCR5380_PUBLIC_RELEASE);
+   seq_printf(m, Generic5380 release %d, GENERIC_NCR5380_PUBLIC_RELEASE);
 #endif
 #ifdef PAS16_PUBLIC_RELEASE
-   SPRINTF(PAS16 release=%d, PAS16_PUBLIC_RELEASE);
+   seq_printf(m, PAS16 release=%d, PAS16_PUBLIC_RELEASE);
 #endif
 
-   SPRINTF(\nBase Addr: 0x%05lX, (long) instance-base);
-   SPRINTF(io_port: %04x  , (int) instance-io_port);
+   seq_printf(m, \nBase Addr: 0x%05lX, (long) instance-base);
+   seq_printf(m, io_port: %04x  , (int) instance-io_port);
if (instance-irq == SCSI_IRQ_NONE)
-   SPRINTF(IRQ: None.\n);
+   seq_printf(m, IRQ: None.\n);
else
-   SPRINTF(IRQ: %d.\n, instance-irq);
+   seq_printf(m, IRQ: %d.\n, instance-irq);
 
 #ifdef DTC_PUBLIC_RELEASE
-   SPRINTF(Highwater I/O busy_spin_counts -- write: %d  read: %d\n, 
dtc_wmaxi, dtc_maxi);
+   seq_printf(m, Highwater I/O busy_spin_counts -- write: %d  read: 
%d\n, dtc_wmaxi, dtc_maxi);
 #endif
 #ifdef PAS16_PUBLIC_RELEASE
-   SPRINTF(Highwater I/O busy_spin_counts -- write: %d  read: %d\n, 
pas_wmaxi, pas_maxi);
+   seq_printf(m, Highwater I/O busy_spin_counts -- write: %d  read: 
%d\n, pas_wmaxi, pas_maxi);
 #endif
spin_lock_irq(instance-host_lock);
if (!hostdata-connected)
-   SPRINTF(scsi%d: no currently connected command\n, 
instance-host_no);
+   seq_printf(m, scsi%d: no currently connected command\n, 
instance-host_no);
else
lprint_Scsi_Cmnd((Scsi_Cmnd *) hostdata-connected, m);
-   SPRINTF(scsi%d: issue_queue\n, instance-host_no);
+   seq_printf(m, scsi%d: issue_queue\n, instance-host_no);
for (ptr = (Scsi_Cmnd *) hostdata-issue_queue; ptr; ptr = (Scsi_Cmnd 
*) ptr-host_scribble)
lprint_Scsi_Cmnd(ptr, m);
 
-   SPRINTF(scsi%d: disconnected_queue\n, instance-host_no);
+   seq_printf(m, scsi%d: disconnected_queue\n, instance-host_no);
for (ptr = (Scsi_Cmnd *) hostdata-disconnected_queue; ptr; ptr = 
(Scsi_Cmnd *) ptr-host_scribble)
lprint_Scsi_Cmnd(ptr, m);
spin_unlock_irq(instance-host_lock);
@@ -762,8 +760,8 @@ static int __maybe_unused NCR5380_show_info(struct seq_file 
*m,
 
 static void lprint_Scsi_Cmnd(Scsi_Cmnd * cmd, struct seq_file *m)
 {
-   SPRINTF(scsi%d : destination target %d, lun %llu\n, 
cmd-device-host-host_no, cmd-device-id, cmd-device-lun);
-   SPRINTF(command = );
+   seq_printf(m, scsi%d : destination target %d, lun %llu\n, 
cmd-device-host-host_no, cmd-device-id, cmd-device-lun);
+   seq_printf(m, command = );
lprint_command(cmd-cmnd, m);
 }
 
@@ -772,13 +770,13 @@ static void lprint_command(unsigned char *command, struct 
seq_file *m)
int i, s;
lprint_opcode(command[0], m);
for (i = 1, s = COMMAND_SIZE(command[0]); i  s; ++i)
-   SPRINTF(%02x , command[i]);
-   SPRINTF(\n);
+ 

[PATCH 7/7] scsi: misc: Print single-character strings with seq_putc

2014-11-28 Thread Rasmus Villemoes
Using seq_putc to print a single character saves at least a strlen()
call and a memory access, and may also give a small .text reduction.

Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk
---
 drivers/scsi/NCR5380.c  |  2 +-
 drivers/scsi/advansys.c | 34 +-
 drivers/scsi/aha152x.c  |  2 +-
 drivers/scsi/aic7xxx/aic79xx_proc.c | 10 +-
 drivers/scsi/aic7xxx/aic7xxx_proc.c | 10 +-
 drivers/scsi/atari_NCR5380.c|  2 +-
 drivers/scsi/dc395x.c   |  4 ++--
 drivers/scsi/esas2r/esas2r_main.c   |  2 +-
 drivers/scsi/g_NCR5380.c|  6 +++---
 drivers/scsi/in2000.c   |  2 +-
 drivers/scsi/ips.c  |  2 +-
 drivers/scsi/nsp32.c|  2 +-
 drivers/scsi/pcmcia/nsp_cs.c|  4 ++--
 drivers/scsi/qla2xxx/qla_dfs.c  |  2 +-
 drivers/scsi/scsi_proc.c| 10 +-
 drivers/scsi/scsi_trace.c   |  2 +-
 drivers/scsi/sun3_NCR5380.c |  2 +-
 drivers/scsi/wd33c93.c  |  2 +-
 18 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index a2ed965..50cfa9a 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -771,7 +771,7 @@ static void lprint_command(unsigned char *command, struct 
seq_file *m)
lprint_opcode(command[0], m);
for (i = 1, s = COMMAND_SIZE(command[0]); i  s; ++i)
seq_printf(m, %02x , command[i]);
-   seq_puts(m, \n);
+   seq_putc(m, '\n');
 }
 
 static void lprint_opcode(int opcode, struct seq_file *m)
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 76e7610..5f2e4ce 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -3089,7 +3089,7 @@ static void asc_prt_asc_board_eeprom(struct seq_file *m, 
struct Scsi_Host *shost
for (i = 0; i = ASC_MAX_TID; i++)
seq_printf(m,  %c,
   (ep-init_sdtr  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-   seq_puts(m, \n);
+   seq_putc(m, '\n');
 
 #ifdef CONFIG_ISA
if (asc_dvc_varp-bus_type  ASC_IS_ISA) {
@@ -3204,7 +3204,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, 
struct Scsi_Host *shost
seq_puts(m,  Target ID:   );
for (i = 0; i = ADV_MAX_TID; i++)
seq_printf(m,  %X, i);
-   seq_puts(m, \n);
+   seq_putc(m, '\n');
 
if (adv_dvc_varp-chip_type == ADV_CHIP_ASC3550) {
word = ep_3550-disc_enable;
@@ -3217,7 +3217,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, 
struct Scsi_Host *shost
for (i = 0; i = ADV_MAX_TID; i++)
seq_printf(m,  %c,
   (word  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-   seq_puts(m, \n);
+   seq_putc(m, '\n');
 
if (adv_dvc_varp-chip_type == ADV_CHIP_ASC3550) {
word = ep_3550-tagqng_able;
@@ -3230,7 +3230,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, 
struct Scsi_Host *shost
for (i = 0; i = ADV_MAX_TID; i++)
seq_printf(m,  %c,
   (word  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-   seq_puts(m, \n);
+   seq_putc(m, '\n');
 
if (adv_dvc_varp-chip_type == ADV_CHIP_ASC3550) {
word = ep_3550-start_motor;
@@ -3243,7 +3243,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, 
struct Scsi_Host *shost
for (i = 0; i = ADV_MAX_TID; i++)
seq_printf(m,  %c,
   (word  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-   seq_puts(m, \n);
+   seq_putc(m, '\n');
 
if (adv_dvc_varp-chip_type == ADV_CHIP_ASC3550) {
seq_puts(m,  Synchronous Transfer:);
@@ -3251,7 +3251,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, 
struct Scsi_Host *shost
seq_printf(m,  %c,
   (ep_3550-sdtr_able  ADV_TID_TO_TIDMASK(i)) 
?
   'Y' : 'N');
-   seq_puts(m, \n);
+   seq_putc(m, '\n');
}
 
if (adv_dvc_varp-chip_type == ADV_CHIP_ASC3550) {
@@ -3260,7 +3260,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, 
struct Scsi_Host *shost
seq_printf(m,  %c,
   (ep_3550-ultra_able  ADV_TID_TO_TIDMASK(i))
   ? 'Y' : 'N');
-   seq_puts(m, \n);
+   seq_putc(m, '\n');
}
 
if (adv_dvc_varp-chip_type == ADV_CHIP_ASC3550) {
@@ -3274,7 +3274,7 @@ static void asc_prt_adv_board_eeprom(struct seq_file *m, 
struct Scsi_Host *shost
for (i = 0; i = ADV_MAX_TID; i++)
seq_printf(m,  %c,
   (word  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-   seq_puts(m, \n);
+   seq_putc(m, '\n');
 
if (adv_dvc_varp-chip_type == ADV_CHIP_ASC38C0800 ||

[PATCH 6/7] scsi: misc: Merge consecutive seq_puts calls

2014-11-28 Thread Rasmus Villemoes
Consecutive seq_puts calls with literal strings may be replaced by a
single call, saving a little .text.

Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk
---
 drivers/scsi/advansys.c  | 40 ++--
 drivers/scsi/atp870u.c   |  5 ++---
 drivers/scsi/dc395x.c|  4 ++--
 drivers/scsi/pcmcia/nsp_cs.c |  4 ++--
 4 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 720faea..76e7610 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -2903,10 +2903,9 @@ static void asc_prt_adv_bios(struct seq_file *m, struct 
Scsi_Host *shost)
 * the BIOS code segment base address.
 */
if (boardp-bios_signature != 0x55AA) {
-   seq_puts(m, Disabled or Pre-3.1\n);
-   seq_puts(m,
-BIOS either disabled or Pre-3.1. If it is pre-3.1, 
then a newer version\n);
seq_puts(m,
+Disabled or Pre-3.1\n
+BIOS either disabled or Pre-3.1. If it is pre-3.1, 
then a newer version\n
 can be found at the ConnectCom FTP site: 
ftp://ftp.connectcom.net/pub\n;);
} else {
major = (boardp-bios_version  12)  0xF;
@@ -2923,9 +2922,8 @@ static void asc_prt_adv_bios(struct seq_file *m, struct 
Scsi_Host *shost)
 */
if (major  3 || (major = 3  minor  1) ||
(major = 3  minor = 1  letter  ('I' - 'A'))) {
-   seq_puts(m,
-Newer version of ROM BIOS is available at the 
ConnectCom FTP site:\n);
-   seq_puts(m, ftp://ftp.connectcom.net/pub\n;);
+   seq_puts(m, Newer version of ROM BIOS is available at 
the ConnectCom FTP site:\n
+   ftp://ftp.connectcom.net/pub\n;);
}
}
 }
@@ -3071,27 +3069,23 @@ static void asc_prt_asc_board_eeprom(struct seq_file 
*m, struct Scsi_Host *shost
seq_puts(m,  Target ID:   );
for (i = 0; i = ASC_MAX_TID; i++)
seq_printf(m,  %d, i);
-   seq_puts(m, \n);
 
-   seq_puts(m,  Disconnects: );
+   seq_puts(m, \n Disconnects: );
for (i = 0; i = ASC_MAX_TID; i++)
seq_printf(m,  %c,
   (ep-disc_enable  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 
'N');
-   seq_puts(m, \n);
 
-   seq_puts(m,  Command Queuing: );
+   seq_puts(m, \n Command Queuing: );
for (i = 0; i = ASC_MAX_TID; i++)
seq_printf(m,  %c,
   (ep-use_cmd_qng  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 
'N');
-   seq_puts(m, \n);
 
-   seq_puts(m,  Start Motor: );
+   seq_puts(m, \n Start Motor: );
for (i = 0; i = ASC_MAX_TID; i++)
seq_printf(m,  %c,
   (ep-start_motor  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 
'N');
-   seq_puts(m, \n);
 
-   seq_puts(m,  Synchronous Transfer:);
+   seq_puts(m, \n Synchronous Transfer:);
for (i = 0; i = ASC_MAX_TID; i++)
seq_printf(m,  %c,
   (ep-init_sdtr  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
@@ -3410,10 +3404,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, 
struct Scsi_Host *shost)
   i,
   (v-use_tagged_qng  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 
'N');
}
-   seq_puts(m, \n);
 
/* Current number of commands waiting for a device. */
-   seq_puts(m,  Command Queue Pending:);
+   seq_puts(m, \n Command Queue Pending:);
for (i = 0; i = ASC_MAX_TID; i++) {
if ((chip_scsi_id == i) ||
((boardp-init_tidmask  ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3421,10 +3414,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, 
struct Scsi_Host *shost)
}
seq_printf(m,  %X:%u, i, v-cur_dvc_qng[i]);
}
-   seq_puts(m, \n);
 
/* Current limit on number of commands that can be sent to a device. */
-   seq_puts(m,  Command Queue Limit:);
+   seq_puts(m, \n Command Queue Limit:);
for (i = 0; i = ASC_MAX_TID; i++) {
if ((chip_scsi_id == i) ||
((boardp-init_tidmask  ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3432,10 +3424,9 @@ static void asc_prt_asc_board_info(struct seq_file *m, 
struct Scsi_Host *shost)
}
seq_printf(m,  %X:%u, i, v-max_dvc_qng[i]);
}
-   seq_puts(m, \n);
 
/* Indicate whether the device has returned queue full status. */
-   seq_puts(m,  Command Queue Full:);
+   seq_puts(m, \n Command Queue Full:);
for (i = 0; i = ASC_MAX_TID; i++) {
if ((chip_scsi_id == i) ||
((boardp-init_tidmask  ADV_TID_TO_TIDMASK(i)) == 0)) {
@@ -3447,9 +3438,8 @@ 

[PATCH 5/7] scsi: misc: Replace seq_printf with seq_puts

2014-11-28 Thread Rasmus Villemoes
Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.

Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk
---
 drivers/scsi/BusLogic.c | 10 +-
 drivers/scsi/NCR5380.c  |  6 +++---
 drivers/scsi/aic7xxx/aic79xx_proc.c | 38 ++---
 drivers/scsi/aic7xxx/aic7xxx_proc.c | 24 +++
 drivers/scsi/arm/fas216.c   |  6 +++---
 drivers/scsi/atari_NCR5380.c|  4 ++--
 drivers/scsi/atp870u.c  |  6 +++---
 drivers/scsi/dc395x.c   | 16 
 drivers/scsi/dpt_i2o.c  |  2 +-
 drivers/scsi/eata_pio.c |  2 +-
 drivers/scsi/g_NCR5380.c| 24 +++
 drivers/scsi/gdth_proc.c| 24 +++
 drivers/scsi/in2000.c   | 18 +-
 drivers/scsi/ips.c  |  7 +++
 drivers/scsi/megaraid.c |  2 +-
 drivers/scsi/nsp32.c| 14 +++---
 drivers/scsi/pcmcia/nsp_cs.c| 30 ++---
 drivers/scsi/qla2xxx/qla_dfs.c  |  8 
 drivers/scsi/scsi_proc.c| 22 ++---
 drivers/scsi/scsi_trace.c   |  6 +++---
 drivers/scsi/sun3_NCR5380.c |  4 ++--
 drivers/scsi/wd33c93.c  | 18 +-
 drivers/scsi/wd7000.c   | 12 ++--
 23 files changed, 150 insertions(+), 153 deletions(-)

diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index 64c7514..7a91d60 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -3485,7 +3485,7 @@ static int blogic_show_info(struct seq_file *m, struct 
Scsi_Host *shost)
seq_printf(m, \n\
 Current Driver Queue Depth:%d\n\
 Currently Allocated CCBs:  %d\n, adapter-drvr_qdepth, 
adapter-alloc_ccbs);
-   seq_printf(m, \n\n\
+   seq_puts(m, \n\n\
   DATA TRANSFER STATISTICS\n\
 \n\
 Target Tagged Queuing  Queue Depth  Active  Attempted  Completed\n\
@@ -3500,7 +3500,7 @@ TargetTagged Queuing  Queue Depth  Active  Attempted  
Completed\n\
seq_printf(m,
   %3d   %3u%9u%9u\n, 
adapter-qdepth[tgt], adapter-active_cmds[tgt], tgt_stats[tgt].cmds_tried, 
tgt_stats[tgt].cmds_complete);
}
-   seq_printf(m, \n\
+   seq_puts(m, \n\
 Target  Read Commands  Write Commands   Total Bytes ReadTotal Bytes 
Written\n\
 ==  =  ==  ===  
===\n);
for (tgt = 0; tgt  adapter-maxdev; tgt++) {
@@ -3517,7 +3517,7 @@ Target  Read Commands  Write Commands   Total Bytes Read  
  Total Bytes Written\
else
seq_printf(m,   %9u\n, 
tgt_stats[tgt].byteswritten.units);
}
-   seq_printf(m, \n\
+   seq_puts(m, \n\
 Target  Command0-1KB  1-2KB  2-4KB  4-8KB 8-16KB\n\
 ==  ===  =  =  =  =  =\n);
for (tgt = 0; tgt  adapter-maxdev; tgt++) {
@@ -3533,7 +3533,7 @@ Target  Command0-1KB  1-2KB  2-4KB  4-8KB 
8-16KB\n\
tgt_stats[tgt].write_sz_buckets[0],
tgt_stats[tgt].write_sz_buckets[1], 
tgt_stats[tgt].write_sz_buckets[2], tgt_stats[tgt].write_sz_buckets[3], 
tgt_stats[tgt].write_sz_buckets[4]);
}
-   seq_printf(m, \n\
+   seq_puts(m, \n\
 Target  Command   16-32KB32-64KB   64-128KB   128-256KB   256KB+\n\
 ==  ===  =  =  =  =  =\n);
for (tgt = 0; tgt  adapter-maxdev; tgt++) {
@@ -3549,7 +3549,7 @@ Target  Command   16-32KB32-64KB   64-128KB   
128-256KB   256KB+\n\
tgt_stats[tgt].write_sz_buckets[5],
tgt_stats[tgt].write_sz_buckets[6], 
tgt_stats[tgt].write_sz_buckets[7], tgt_stats[tgt].write_sz_buckets[8], 
tgt_stats[tgt].write_sz_buckets[9]);
}
-   seq_printf(m, \n\n\
+   seq_puts(m, \n\n\
   ERROR RECOVERY STATISTICS\n\
 \n\
  Command Aborts  Bus Device Resets   Host Adapter Resets\n\
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index 8395930..a2ed965 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -732,7 +732,7 @@ static int __maybe_unused NCR5380_show_info(struct seq_file 
*m,
seq_printf(m, \nBase Addr: 0x%05lX, (long) instance-base);
seq_printf(m, io_port: %04x  , (int) instance-io_port);
if (instance-irq == SCSI_IRQ_NONE)
-   seq_printf(m, IRQ: None.\n);
+   seq_puts(m, IRQ: None.\n);
else
seq_printf(m, IRQ: %d.\n, instance-irq);
 
@@ -761,7 +761,7 @@ static int __maybe_unused NCR5380_show_info(struct seq_file 
*m,
 

[PATCH 4/7] scsi/aha152x: Replace seq_printf with seq_puts

2014-11-28 Thread Rasmus Villemoes
Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.

Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk
---
 drivers/scsi/aha152x.c | 252 -
 1 file changed, 126 insertions(+), 126 deletions(-)

diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index 80823ac..05cad58 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -2991,21 +2991,21 @@ static void get_command(struct seq_file *m, Scsi_Cmnd * 
ptr)
ptr-SCp.buffers_residual);
 
if (ptr-SCp.phase  not_issued)
-   seq_printf(m, not issued|);
+   seq_puts(m, not issued|);
if (ptr-SCp.phase  selecting)
-   seq_printf(m, selecting|);
+   seq_puts(m, selecting|);
if (ptr-SCp.phase  disconnected)
-   seq_printf(m, disconnected|);
+   seq_puts(m, disconnected|);
if (ptr-SCp.phase  aborted)
-   seq_printf(m, aborted|);
+   seq_puts(m, aborted|);
if (ptr-SCp.phase  identified)
-   seq_printf(m, identified|);
+   seq_puts(m, identified|);
if (ptr-SCp.phase  completed)
-   seq_printf(m, completed|);
+   seq_puts(m, completed|);
if (ptr-SCp.phase  spiordy)
-   seq_printf(m, spiordy|);
+   seq_puts(m, spiordy|);
if (ptr-SCp.phase  syncneg)
-   seq_printf(m, syncneg|);
+   seq_puts(m, syncneg|);
seq_printf(m, ; next=0x%p\n, SCNEXT(ptr));
 }
 
@@ -3016,256 +3016,256 @@ static void get_ports(struct seq_file *m, struct 
Scsi_Host *shpnt)
seq_printf(m, \n%s: %s(%s) , CURRENT_SC ? on bus : waiting, 
states[STATE].name, states[PREVSTATE].name);
 
s = GETPORT(SCSISEQ);
-   seq_printf(m, SCSISEQ( );
+   seq_puts(m, SCSISEQ( );
if (s  TEMODEO)
-   seq_printf(m, TARGET MODE );
+   seq_puts(m, TARGET MODE );
if (s  ENSELO)
-   seq_printf(m, SELO );
+   seq_puts(m, SELO );
if (s  ENSELI)
-   seq_printf(m, SELI );
+   seq_puts(m, SELI );
if (s  ENRESELI)
-   seq_printf(m, RESELI );
+   seq_puts(m, RESELI );
if (s  ENAUTOATNO)
-   seq_printf(m, AUTOATNO );
+   seq_puts(m, AUTOATNO );
if (s  ENAUTOATNI)
-   seq_printf(m, AUTOATNI );
+   seq_puts(m, AUTOATNI );
if (s  ENAUTOATNP)
-   seq_printf(m, AUTOATNP );
+   seq_puts(m, AUTOATNP );
if (s  SCSIRSTO)
-   seq_printf(m, SCSIRSTO );
-   seq_printf(m, ););
+   seq_puts(m, SCSIRSTO );
+   seq_puts(m, ););
 
-   seq_printf(m,  SCSISIG();
+   seq_puts(m,  SCSISIG();
s = GETPORT(SCSISIG);
switch (s  P_MASK) {
case P_DATAO:
-   seq_printf(m, DATA OUT);
+   seq_puts(m, DATA OUT);
break;
case P_DATAI:
-   seq_printf(m, DATA IN);
+   seq_puts(m, DATA IN);
break;
case P_CMD:
-   seq_printf(m, COMMAND);
+   seq_puts(m, COMMAND);
break;
case P_STATUS:
-   seq_printf(m, STATUS);
+   seq_puts(m, STATUS);
break;
case P_MSGO:
-   seq_printf(m, MESSAGE OUT);
+   seq_puts(m, MESSAGE OUT);
break;
case P_MSGI:
-   seq_printf(m, MESSAGE IN);
+   seq_puts(m, MESSAGE IN);
break;
default:
-   seq_printf(m, *invalid*);
+   seq_puts(m, *invalid*);
break;
}
 
-   seq_printf(m, ); );
+   seq_puts(m, ); );
 
seq_printf(m, INTSTAT (%s); , TESTHI(DMASTAT, INTSTAT) ? hi : lo);
 
-   seq_printf(m, SSTAT( );
+   seq_puts(m, SSTAT( );
s = GETPORT(SSTAT0);
if (s  TARGET)
-   seq_printf(m, TARGET );
+   seq_puts(m, TARGET );
if (s  SELDO)
-   seq_printf(m, SELDO );
+   seq_puts(m, SELDO );
if (s  SELDI)
-   seq_printf(m, SELDI );
+   seq_puts(m, SELDI );
if (s  SELINGO)
-   seq_printf(m, SELINGO );
+   seq_puts(m, SELINGO );
if (s  SWRAP)
-   seq_printf(m, SWRAP );
+   seq_puts(m, SWRAP );
if (s  SDONE)
-   seq_printf(m, SDONE );
+   seq_puts(m, SDONE );
if (s  SPIORDY)
-   seq_printf(m, SPIORDY );
+   seq_puts(m, SPIORDY );
if (s  DMADONE)
-   seq_printf(m, DMADONE );
+   seq_puts(m, DMADONE );
 
s = GETPORT(SSTAT1);
if (s  SELTO)
-   seq_printf(m, SELTO );
+   

[PATCH 3/7] scsi/advansys: Replace seq_printf with seq_puts

2014-11-28 Thread Rasmus Villemoes
Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.

Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk
---
 drivers/scsi/advansys.c | 157 
 1 file changed, 77 insertions(+), 80 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 43761c1..720faea 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -2880,7 +2880,7 @@ static void asc_prt_board_devices(struct seq_file *m, 
struct Scsi_Host *shost)
chip_scsi_id = boardp-dvc_var.adv_dvc_var.chip_scsi_id;
}
 
-   seq_printf(m, Target IDs Detected:);
+   seq_puts(m, Target IDs Detected:);
for (i = 0; i = ADV_MAX_TID; i++) {
if (boardp-init_tidmask  ADV_TID_TO_TIDMASK(i))
seq_printf(m,  %X,, i);
@@ -2896,18 +2896,18 @@ static void asc_prt_adv_bios(struct seq_file *m, struct 
Scsi_Host *shost)
struct asc_board *boardp = shost_priv(shost);
ushort major, minor, letter;
 
-   seq_printf(m, \nROM BIOS Version: );
+   seq_puts(m, \nROM BIOS Version: );
 
/*
 * If the BIOS saved a valid signature, then fill in
 * the BIOS code segment base address.
 */
if (boardp-bios_signature != 0x55AA) {
-   seq_printf(m, Disabled or Pre-3.1\n);
-   seq_printf(m,
- BIOS either disabled or Pre-3.1. If it is pre-3.1, 
then a newer version\n);
-   seq_printf(m,
- can be found at the ConnectCom FTP site: 
ftp://ftp.connectcom.net/pub\n;);
+   seq_puts(m, Disabled or Pre-3.1\n);
+   seq_puts(m,
+BIOS either disabled or Pre-3.1. If it is pre-3.1, 
then a newer version\n);
+   seq_puts(m,
+can be found at the ConnectCom FTP site: 
ftp://ftp.connectcom.net/pub\n;);
} else {
major = (boardp-bios_version  12)  0xF;
minor = (boardp-bios_version  8)  0xF;
@@ -2923,10 +2923,9 @@ static void asc_prt_adv_bios(struct seq_file *m, struct 
Scsi_Host *shost)
 */
if (major  3 || (major = 3  minor  1) ||
(major = 3  minor = 1  letter  ('I' - 'A'))) {
-   seq_printf(m,
-  Newer version of ROM BIOS is available at 
the ConnectCom FTP site:\n);
-   seq_printf(m,
-  ftp://ftp.connectcom.net/pub\n;);
+   seq_puts(m,
+Newer version of ROM BIOS is available at the 
ConnectCom FTP site:\n);
+   seq_puts(m, ftp://ftp.connectcom.net/pub\n;);
}
}
 }
@@ -3056,11 +3055,10 @@ static void asc_prt_asc_board_eeprom(struct seq_file 
*m, struct Scsi_Host *shost
== ASC_TRUE)
seq_printf(m,  Serial Number: %s\n, serialstr);
else if (ep-adapter_info[5] == 0xBB)
-   seq_printf(m,
-   Default Settings Used for EEPROM-less Adapter.\n);
+   seq_puts(m,
+ Default Settings Used for EEPROM-less Adapter.\n);
else
-   seq_printf(m,
-   Serial Number Signature Not Present.\n);
+   seq_puts(m,  Serial Number Signature Not Present.\n);
 
seq_printf(m,
Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: 
%u\n,
@@ -3070,34 +3068,34 @@ static void asc_prt_asc_board_eeprom(struct seq_file 
*m, struct Scsi_Host *shost
seq_printf(m,
cntl 0x%x, no_scam 0x%x\n, ep-cntl, ep-no_scam);
 
-   seq_printf(m,  Target ID:   );
+   seq_puts(m,  Target ID:   );
for (i = 0; i = ASC_MAX_TID; i++)
seq_printf(m,  %d, i);
-   seq_printf(m, \n);
+   seq_puts(m, \n);
 
-   seq_printf(m,  Disconnects: );
+   seq_puts(m,  Disconnects: );
for (i = 0; i = ASC_MAX_TID; i++)
seq_printf(m,  %c,
   (ep-disc_enable  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 
'N');
-   seq_printf(m, \n);
+   seq_puts(m, \n);
 
-   seq_printf(m,  Command Queuing: );
+   seq_puts(m,  Command Queuing: );
for (i = 0; i = ASC_MAX_TID; i++)
seq_printf(m,  %c,
   (ep-use_cmd_qng  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 
'N');
-   seq_printf(m, \n);
+   seq_puts(m, \n);
 
-   seq_printf(m,  Start Motor: );
+   seq_puts(m,  Start Motor: );
for (i = 0; i = ASC_MAX_TID; i++)
seq_printf(m,  %c,
   (ep-start_motor  ADV_TID_TO_TIDMASK(i)) ? 'Y' : 
'N');
-   seq_printf(m, \n);
+   seq_puts(m, \n);
 
-   seq_printf(m,  

[PATCH 2/7] scsi/g_NCR5380: Remove obfuscating macros

2014-11-28 Thread Rasmus Villemoes
The macros PRINTP/ANDP make the code harder to read and depend on a
specific identifier name in the surrounding scope. Nuke them.

Signed-off-by: Rasmus Villemoes li...@rasmusvillemoes.dk
---
 drivers/scsi/g_NCR5380.c | 66 ++--
 1 file changed, 30 insertions(+), 36 deletions(-)

diff --git a/drivers/scsi/g_NCR5380.c b/drivers/scsi/g_NCR5380.c
index b331272..802b64c 100644
--- a/drivers/scsi/g_NCR5380.c
+++ b/drivers/scsi/g_NCR5380.c
@@ -741,12 +741,9 @@ static inline int NCR5380_pwrite(struct Scsi_Host 
*instance, unsigned char *src,
  
 #include NCR5380.c
 
-#define PRINTP(x) seq_printf(m, x)
-#define ANDP ,
-
 static void sprint_opcode(struct seq_file *m, int opcode)
 {
-   PRINTP(0x%02x  ANDP opcode);
+   seq_printf(m, 0x%02x , opcode);
 }
 
 static void sprint_command(struct seq_file *m, unsigned char *command)
@@ -754,8 +751,8 @@ static void sprint_command(struct seq_file *m, unsigned 
char *command)
int i, s;
sprint_opcode(m, command[0]);
for (i = 1, s = COMMAND_SIZE(command[0]); i  s; ++i)
-   PRINTP(%02x  ANDP command[i]);
-   PRINTP(\n);
+   seq_printf(m, %02x , command[i]);
+   seq_printf(m, \n);
 }
 
 /**
@@ -768,8 +765,8 @@ static void sprint_command(struct seq_file *m, unsigned 
char *command)
 
 static void sprint_Scsi_Cmnd(struct seq_file *m, Scsi_Cmnd * cmd)
 {
-   PRINTP(host number %d destination target %d, lun %llu\n ANDP 
cmd-device-host-host_no ANDP cmd-device-id ANDP cmd-device-lun);
-   PRINTP(command = );
+   seq_printf(m, host number %d destination target %d, lun %llu\n, 
cmd-device-host-host_no, cmd-device-id, cmd-device-lun);
+   seq_printf(m, command = );
sprint_command(m, cmd-cmnd);
 }
 
@@ -806,40 +803,40 @@ static int generic_NCR5380_show_info(struct seq_file *m, 
struct Scsi_Host *scsi_
hostdata = (struct NCR5380_hostdata *) scsi_ptr-hostdata;
 
spin_lock_irqsave(scsi_ptr-host_lock, flags);
-   PRINTP(SCSI host number %d : %s\n ANDP scsi_ptr-host_no ANDP 
scsi_ptr-hostt-name);
-   PRINTP(Generic NCR5380 driver version %d\n ANDP 
GENERIC_NCR5380_PUBLIC_RELEASE);
-   PRINTP(NCR5380 core version %d\n ANDP NCR5380_PUBLIC_RELEASE);
+   seq_printf(m, SCSI host number %d : %s\n, scsi_ptr-host_no, 
scsi_ptr-hostt-name);
+   seq_printf(m, Generic NCR5380 driver version %d\n, 
GENERIC_NCR5380_PUBLIC_RELEASE);
+   seq_printf(m, NCR5380 core version %d\n, NCR5380_PUBLIC_RELEASE);
 #ifdef NCR53C400
-   PRINTP(NCR53C400 extension version %d\n ANDP 
NCR53C400_PUBLIC_RELEASE);
-   PRINTP(NCR53C400 card%s detected\n ANDP(((struct NCR5380_hostdata *) 
scsi_ptr-hostdata)-flags  FLAG_NCR53C400) ?  :  not);
+   seq_printf(m, NCR53C400 extension version %d\n, 
NCR53C400_PUBLIC_RELEASE);
+   seq_printf(m, NCR53C400 card%s detected\n, (((struct NCR5380_hostdata 
*) scsi_ptr-hostdata)-flags  FLAG_NCR53C400) ?  :  not);
 # if NCR53C400_PSEUDO_DMA
-   PRINTP(NCR53C400 pseudo DMA used\n);
+   seq_printf(m, NCR53C400 pseudo DMA used\n);
 # endif
 #else
-   PRINTP(NO NCR53C400 driver extensions\n);
+   seq_printf(m, NO NCR53C400 driver extensions\n);
 #endif
-   PRINTP(Using %s mapping at %s 0x%lx,  ANDP STRVAL(NCR5380_map_config) 
ANDP STRVAL(NCR5380_map_name) ANDP scsi_ptr-NCR5380_instance_name);
+   seq_printf(m, Using %s mapping at %s 0x%lx, , 
STRVAL(NCR5380_map_config), STRVAL(NCR5380_map_name), 
scsi_ptr-NCR5380_instance_name);
if (scsi_ptr-irq == SCSI_IRQ_NONE)
-   PRINTP(no interrupt\n);
+   seq_printf(m, no interrupt\n);
else
-   PRINTP(on interrupt %d\n ANDP scsi_ptr-irq);
+   seq_printf(m, on interrupt %d\n, scsi_ptr-irq);
 
 #ifdef NCR5380_STATS
if (hostdata-connected || hostdata-issue_queue || 
hostdata-disconnected_queue)
-   PRINTP(There are commands pending, transfer rates may be 
crud\n);
+   seq_printf(m, There are commands pending, transfer rates may 
be crud\n);
if (hostdata-pendingr)
-   PRINTP(  %d pending reads ANDP hostdata-pendingr);
+   seq_printf(m,   %d pending reads, hostdata-pendingr);
if (hostdata-pendingw)
-   PRINTP(  %d pending writes ANDP hostdata-pendingw);
+   seq_printf(m,   %d pending writes, hostdata-pendingw);
if (hostdata-pendingr || hostdata-pendingw)
-   PRINTP(\n);
+   seq_printf(m, \n);
shost_for_each_device(dev, scsi_ptr) {
unsigned long br = hostdata-bytes_read[dev-id];
unsigned long bw = hostdata-bytes_write[dev-id];
long tr = hostdata-time_read[dev-id] / HZ;
long tw = hostdata-time_write[dev-id] / HZ;
 
-   PRINTP(  T:%d %s  ANDP dev-id ANDP 
scsi_device_type(dev-type));
+   seq_printf(m,   T:%d %s , dev-id, 
scsi_device_type(dev-type));
  

Re: [PATCH] tcm_loop: Wrong I_T nexus association

2014-11-28 Thread Nicholas A. Bellinger
On Wed, 2014-11-26 at 14:58 +0100, Hannes Reinecke wrote:
 tcm_loop has the I_T nexus associated with the HBA. This causes
 commands to become misdirected if the HBA has more than one
 target portal group; any command is then being sent to the
 first target portal group instead of the correct one.
 
 The nexus needs to be associated with the target portal group
 instead.
 
 Signed-off-by: Hannes Reinecke h...@suse.de
 ---
  drivers/target/loopback/tcm_loop.c | 66 
 +-
  drivers/target/loopback/tcm_loop.h |  7 +---
  2 files changed, 24 insertions(+), 49 deletions(-)
 

Nice catch on this long-standing bug with tcm_loop + multi tpg export
configurations.

Applied to target-pending/for-next + stable CC.

Thanks Hannes.

--nab

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


[GIT PULL] SCSI fixes for 3.18-rc6

2014-11-28 Thread James Bottomley
This is a set of ten fixes: 8 for UFS including four static checker
warnings, a potential null deref in the voltage regulator code, a race
on module unload, a ref counting fix on the well known LUNs which made
it impossible to remove the ufs module and fix to correct the
information in pwr_info.  In addition to UFS, there's a blacklist for
the Intel Multi-Flex array which chokes on report supported operation
codes and a fix to an oops in bnx2fc caused by shared skbs.

The patch is available here:

git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes

The short changelog is:

Akinobu Mita (3):
  ufs: fix NULL dereference when no regulators are defined
  ufs: ensure clk gating work is finished before module unloading
  ufs: fix reference counting of W-LUs

Christian Sünkenberg (1):
  scsi: add Intel Multi-Flex to scsi scan blacklist

Dolev Raviv (4):
  scsi: ufs: fix static checker warning in ufshcd_parse_clock_info
  scsi: ufs: fix static checker warning in __ufshcd_setup_clocks
  scsi: ufs: fix static checker warning in ufshcd_populate_vreg
  scsi: ufs: fix static checker errors in ufshcd_system_suspend

Maurizio Lombardi (1):
  bnx2fc: do not add shared skbs to the fcoe_rx_list

Yaniv Gardi (1):
  ufs: fix power info after link start-up

and the diffstat:

 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   7 +++
 drivers/scsi/scsi_devinfo.c   |   1 +
 drivers/scsi/ufs/ufshcd-pltfrm.c  |  15 ++
 drivers/scsi/ufs/ufshcd.c | 104 +++---
 drivers/scsi/ufs/ufshcd.h |   2 -
 5 files changed, 77 insertions(+), 52 deletions(-)

With full diff below.

James

---

diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c 
b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 79e5c94..72533c5 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -412,6 +412,7 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct 
net_device *dev,
struct fc_frame_header *fh;
struct fcoe_rcv_info *fr;
struct fcoe_percpu_s *bg;
+   struct sk_buff *tmp_skb;
unsigned short oxid;
 
interface = container_of(ptype, struct bnx2fc_interface,
@@ -424,6 +425,12 @@ static int bnx2fc_rcv(struct sk_buff *skb, struct 
net_device *dev,
goto err;
}
 
+   tmp_skb = skb_share_check(skb, GFP_ATOMIC);
+   if (!tmp_skb)
+   goto err;
+
+   skb = tmp_skb;
+
if (unlikely(eth_hdr(skb)-h_proto != htons(ETH_P_FCOE))) {
printk(KERN_ERR PFX bnx2fc_rcv: Wrong FC type frame\n);
goto err;
diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
index 49014a1..c1d04d4 100644
--- a/drivers/scsi/scsi_devinfo.c
+++ b/drivers/scsi/scsi_devinfo.c
@@ -202,6 +202,7 @@ static struct {
{IOMEGA, Io20S *F, NULL, BLIST_KEY},
{INSITE, Floptical   F*8I, NULL, BLIST_KEY},
{INSITE, I325VM, NULL, BLIST_KEY},
+   {Intel, Multi-Flex, NULL, BLIST_NO_RSOC},
{iRiver, iFP Mass Driver, NULL, BLIST_NOT_LOCKABLE | 
BLIST_INQUIRY_36},
{LASOUND, CDX7405, 3.10, BLIST_MAX5LUN | BLIST_SINGLELUN},
{MATSHITA, PD-1, NULL, BLIST_FORCELUN | BLIST_SINGLELUN},
diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
index 8adf067..1c3467b 100644
--- a/drivers/scsi/ufs/ufshcd-pltfrm.c
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
@@ -102,7 +102,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq),
GFP_KERNEL);
if (!clkfreq) {
-   dev_err(dev, %s: no memory\n, freq-table-hz);
ret = -ENOMEM;
goto out;
}
@@ -112,19 +111,19 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
if (ret  (ret != -EINVAL)) {
dev_err(dev, %s: error reading array %d\n,
freq-table-hz, ret);
-   goto free_clkfreq;
+   return ret;
}
 
for (i = 0; i  sz; i += 2) {
ret = of_property_read_string_index(np,
clock-names, i/2, (const char **)name);
if (ret)
-   goto free_clkfreq;
+   goto out;
 
clki = devm_kzalloc(dev, sizeof(*clki), GFP_KERNEL);
if (!clki) {
ret = -ENOMEM;
-   goto free_clkfreq;
+   goto out;
}
 
clki-min_freq = clkfreq[i];
@@ -134,8 +133,6 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
clki-min_freq, clki-max_freq, clki-name);
list_add_tail(clki-list, hba-clk_list_head);
}
-free_clkfreq:
-   kfree(clkfreq);
 out:
return ret;
 }
@@ -162,10 +159,8 @@ static int ufshcd_populate_vreg(struct device *dev, const 
char *name,
}