Let's don't check if data should be copied between dev handler's and target driver's buffers on the fast path and make it a duty of a target driver who might need it.

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1244 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2009-10-22 15:40:42 +00:00
parent 6606bb50de
commit 29feda5143
5 changed files with 31 additions and 14 deletions
+11
View File
@@ -3014,6 +3014,17 @@ static inline void sg_clear(struct scatterlist *sg)
#endif
}
enum scst_sg_copy_dir {
SCST_SG_COPY_FROM_TARGET,
SCST_SG_COPY_TO_TARGET
};
/*
* Copies data between cmd->tgt_sg and cmd->sg in direction defined by
* copy_dir parameter.
*/
void scst_copy_sg(struct scst_cmd *cmd, enum scst_sg_copy_dir copy_dir);
/*
* Functions for access to the commands data (SG) buffer,
* including HIGHMEM environment. Should be used instead of direct
+1
View File
@@ -3184,6 +3184,7 @@ out:
TRACE_EXIT();
return;
}
EXPORT_SYMBOL(scst_copy_sg);
static const int SCST_CDB_LENGTH[8] = { 6, 10, 10, -1, 16, 12, -1, -1 };
-6
View File
@@ -401,12 +401,6 @@ int scst_alloc_space(struct scst_cmd *cmd);
int scst_lib_init(void);
void scst_lib_exit(void);
enum scst_sg_copy_dir {
SCST_SG_COPY_FROM_TARGET,
SCST_SG_COPY_TO_TARGET
};
void scst_copy_sg(struct scst_cmd *cmd, enum scst_sg_copy_dir);
uint64_t scst_pack_lun(const uint64_t lun);
uint64_t scst_unpack_lun(const uint8_t *lun, int len);
-8
View File
@@ -2238,10 +2238,6 @@ static int scst_exec(struct scst_cmd **active_cmd)
cmd->scst_cmd_done = scst_cmd_done_local;
cmd->state = SCST_CMD_STATE_LOCAL_EXEC;
if (cmd->tgt_data_buf_alloced && cmd->dh_data_buf_alloced &&
(cmd->data_direction & SCST_DATA_WRITE))
scst_copy_sg(cmd, SCST_SG_COPY_FROM_TARGET);
rc = scst_do_local_exec(cmd);
if (likely(rc == SCST_EXEC_NOT_COMPLETED))
/* Nothing to do */;
@@ -2907,10 +2903,6 @@ static int scst_pre_xmit_response(struct scst_cmd *cmd)
goto out;
}
if (cmd->tgt_data_buf_alloced && cmd->dh_data_buf_alloced &&
(cmd->data_direction & SCST_DATA_READ))
scst_copy_sg(cmd, SCST_SG_COPY_TO_TARGET);
cmd->state = SCST_CMD_STATE_XMIT_RESP;
res = SCST_CMD_STATE_RES_CONT_SAME;
+19
View File
@@ -618,6 +618,20 @@ static int scst_local_queuecommand(struct scsi_cmnd *SCpnt,
return 0;
}
static int scst_local_targ_pre_exec(struct scst_cmd *scst_cmd)
{
int res = SCST_PREPROCESS_STATUS_SUCCESS;
TRACE_ENTRY();
if (scst_cmd_get_dh_data_buff_alloced(scst_cmd) &&
(scst_cmd_get_data_direction(scst_cmd) & SCST_DATA_WRITE))
scst_copy_sg(scst_cmd, SCST_SG_COPY_FROM_TARGET);
TRACE_EXIT_RES(res);
return res;
}
static void scst_local_release_adapter(struct device *dev)
{
struct scst_local_host_info *scst_lcl_host;
@@ -1068,6 +1082,10 @@ static int scst_local_targ_xmit_response(struct scst_cmd *scst_cmd)
return SCST_TGT_RES_SUCCESS;
}
if (scst_cmd_get_dh_data_buff_alloced(scst_cmd) &&
(scst_cmd_get_data_direction(scst_cmd) & SCST_DATA_READ))
scst_copy_sg(scst_cmd, SCST_SG_COPY_TO_TARGET);
tgt_specific = scst_cmd_get_tgt_priv(scst_cmd);
/*
@@ -1124,6 +1142,7 @@ static struct scst_tgt_template scst_local_targ_tmpl = {
.xmit_response_atomic = 1,
.detect = scst_local_targ_detect,
.release = scst_local_targ_release,
.pre_exec = scst_local_targ_pre_exec,
.xmit_response = scst_local_targ_xmit_response,
.on_free_cmd = scst_local_targ_on_free_cmd,
.task_mgmt_fn_done = scst_local_targ_task_mgmt_done,