[PATCH 3/4] pscsi: call spc_emulate_report_luns directly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No need to indirect through spc_parse_cdb if we only ever call it for
REPORT LUNS emulation.

Signed-off-by: Christoph Hellwig <hch@xxxxxx>

---
 drivers/target/target_core_pscsi.c   |    9 ++-------
 drivers/target/target_core_spc.c     |    2 +-
 include/target/target_core_backend.h |    1 +
 3 files changed, 4 insertions(+), 8 deletions(-)

Index: lio-core/drivers/target/target_core_pscsi.c
===================================================================
--- lio-core.orig/drivers/target/target_core_pscsi.c	2012-10-07 05:37:48.807917807 -0700
+++ lio-core/drivers/target/target_core_pscsi.c	2012-10-07 05:41:29.391911734 -0700
@@ -985,8 +985,6 @@ static inline void pscsi_clear_cdb_lun(u
 static int pscsi_parse_cdb(struct se_cmd *cmd)
 {
 	unsigned char *cdb = cmd->t_task_cdb;
-	unsigned int dummy_size;
-	int ret;
 
 	if (cmd->se_cmd_flags & SCF_BIDI) {
 		cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
@@ -1003,10 +1001,7 @@ static int pscsi_parse_cdb(struct se_cmd
 	 */
 	switch (cdb[0]) {
 	case REPORT_LUNS:
-		ret = spc_parse_cdb(cmd, &dummy_size);
-		if (ret)
-			return ret;
-		break;
+		return spc_emulate_report_luns(cmd);
 	case READ_6:
 	case READ_10:
 	case READ_12:
@@ -1020,10 +1015,8 @@ static int pscsi_parse_cdb(struct se_cmd
 		/* FALLTHROUGH*/
 	default:
 		cmd->execute_cmd = pscsi_execute_cmd;
-		break;
+		return 0;
 	}
-
-	return 0;
 }
 
 static int pscsi_execute_cmd(struct se_cmd *cmd)
Index: lio-core/drivers/target/target_core_spc.c
===================================================================
--- lio-core.orig/drivers/target/target_core_spc.c	2012-10-07 05:39:39.363914772 -0700
+++ lio-core/drivers/target/target_core_spc.c	2012-10-07 05:40:58.863912575 -0700
@@ -906,7 +906,7 @@ static int spc_emulate_request_sense(str
 	return 0;
 }
 
-static int spc_emulate_report_luns(struct se_cmd *cmd)
+int spc_emulate_report_luns(struct se_cmd *cmd)
 {
 	struct se_dev_entry *deve;
 	struct se_session *sess = cmd->se_sess;
Index: lio-core/include/target/target_core_backend.h
===================================================================
--- lio-core.orig/include/target/target_core_backend.h	2012-10-07 05:37:48.807917807 -0700
+++ lio-core/include/target/target_core_backend.h	2012-10-07 05:40:11.383913881 -0700
@@ -52,6 +52,7 @@ void	target_complete_cmd(struct se_cmd *
 
 int	sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops);
 int	spc_parse_cdb(struct se_cmd *cmd, unsigned int *size);
+int	spc_emulate_report_luns(struct se_cmd *cmd);
 int	spc_get_write_same_sectors(struct se_cmd *cmd);
 
 void	transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);

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


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux