Commit 8de530a5 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nicholas Bellinger

target/pscsi: call spc_emulate_report_luns directly

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

(nab: Add missing EXPORT_SYMBOL for spc_emulate_report_luns)
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent d1b1f805
...@@ -985,8 +985,6 @@ static inline void pscsi_clear_cdb_lun(unsigned char *cdb) ...@@ -985,8 +985,6 @@ static inline void pscsi_clear_cdb_lun(unsigned char *cdb)
static int pscsi_parse_cdb(struct se_cmd *cmd) static int pscsi_parse_cdb(struct se_cmd *cmd)
{ {
unsigned char *cdb = cmd->t_task_cdb; unsigned char *cdb = cmd->t_task_cdb;
unsigned int dummy_size;
int ret;
if (cmd->se_cmd_flags & SCF_BIDI) { if (cmd->se_cmd_flags & SCF_BIDI) {
cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION; cmd->se_cmd_flags |= SCF_SCSI_CDB_EXCEPTION;
...@@ -1003,10 +1001,7 @@ static int pscsi_parse_cdb(struct se_cmd *cmd) ...@@ -1003,10 +1001,7 @@ static int pscsi_parse_cdb(struct se_cmd *cmd)
*/ */
switch (cdb[0]) { switch (cdb[0]) {
case REPORT_LUNS: case REPORT_LUNS:
ret = spc_parse_cdb(cmd, &dummy_size); return spc_emulate_report_luns(cmd);
if (ret)
return ret;
break;
case READ_6: case READ_6:
case READ_10: case READ_10:
case READ_12: case READ_12:
...@@ -1020,10 +1015,8 @@ static int pscsi_parse_cdb(struct se_cmd *cmd) ...@@ -1020,10 +1015,8 @@ static int pscsi_parse_cdb(struct se_cmd *cmd)
/* FALLTHROUGH*/ /* FALLTHROUGH*/
default: default:
cmd->execute_cmd = pscsi_execute_cmd; cmd->execute_cmd = pscsi_execute_cmd;
break;
}
return 0; return 0;
}
} }
static int pscsi_execute_cmd(struct se_cmd *cmd) static int pscsi_execute_cmd(struct se_cmd *cmd)
......
...@@ -908,7 +908,7 @@ static int spc_emulate_request_sense(struct se_cmd *cmd) ...@@ -908,7 +908,7 @@ static int spc_emulate_request_sense(struct se_cmd *cmd)
return 0; 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_dev_entry *deve;
struct se_session *sess = cmd->se_sess; struct se_session *sess = cmd->se_sess;
...@@ -970,6 +970,7 @@ static int spc_emulate_report_luns(struct se_cmd *cmd) ...@@ -970,6 +970,7 @@ static int spc_emulate_report_luns(struct se_cmd *cmd)
target_complete_cmd(cmd, GOOD); target_complete_cmd(cmd, GOOD);
return 0; return 0;
} }
EXPORT_SYMBOL(spc_emulate_report_luns);
static int spc_emulate_testunitready(struct se_cmd *cmd) static int spc_emulate_testunitready(struct se_cmd *cmd)
{ {
......
...@@ -52,6 +52,7 @@ void target_complete_cmd(struct se_cmd *, u8); ...@@ -52,6 +52,7 @@ void target_complete_cmd(struct se_cmd *, u8);
int sbc_parse_cdb(struct se_cmd *cmd, struct sbc_ops *ops); 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_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); int spc_get_write_same_sectors(struct se_cmd *cmd);
void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *); void transport_set_vpd_proto_id(struct t10_vpd *, unsigned char *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment