git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4622 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2012-11-14 23:48:52 +00:00
parent b80d55ec5d
commit b30651cda0
7 changed files with 31 additions and 31 deletions

View File

@@ -3880,7 +3880,7 @@ struct scst_tgt_template iscsi_template = {
.release = iscsi_target_release,
.xmit_response = iscsi_xmit_response,
#if !defined(CONFIG_TCP_ZERO_COPY_TRANSFER_COMPLETION_NOTIFICATION)
.alloc_data_buf = iscsi_alloc_data_buf,
.tgt_alloc_data_buf = iscsi_alloc_data_buf,
#endif
.preprocessing_done = iscsi_preprocessing_done,
.pre_exec = iscsi_pre_exec,

View File

@@ -760,7 +760,7 @@ struct scst_tgt_template {
* Target driver doesn't have to always allocate buffer in this
* function, but if it decide to do it, it must check that
* scst_cmd_get_data_buff_alloced() returns 0, otherwise to avoid
* double buffer allocation and memory leaks alloc_data_buf() shall
* double buffer allocation and memory leaks tgt_alloc_data_buf() shall
* fail.
*
* Shall return 0 in case of success or < 0 (preferably -ENOMEM)
@@ -782,7 +782,7 @@ struct scst_tgt_template {
*
* OPTIONAL.
*/
int (*alloc_data_buf) (struct scst_cmd *cmd);
int (*tgt_alloc_data_buf) (struct scst_cmd *cmd);
/*
* This function informs the driver that data
@@ -1160,7 +1160,7 @@ struct scst_dev_type {
* the atomic (non-sleeping) context
*/
unsigned parse_atomic:1;
unsigned alloc_data_buf_atomic:1;
unsigned dev_alloc_data_buf_atomic:1;
unsigned dev_done_atomic:1;
#ifdef CONFIG_SCST_PROC
@@ -1219,7 +1219,7 @@ struct scst_dev_type {
*
* OPTIONAL
*/
int (*alloc_data_buf) (struct scst_cmd *cmd);
int (*dev_alloc_data_buf) (struct scst_cmd *cmd);
/*
* Called to execute CDB. Useful, for instance, to implement
@@ -1903,8 +1903,8 @@ struct scst_cmd {
/*
* Set if the target driver wants to alloc data buffers on its own.
* In this case alloc_data_buf() must be provided in the target driver
* template.
* In this case tgt_alloc_data_buf() must be provided in the target
* driver template.
*/
unsigned int tgt_need_alloc_data_buf:1;

View File

@@ -2789,7 +2789,7 @@ static void dev_user_setup_functions(struct scst_user_dev *dev)
TRACE_ENTRY();
dev->devtype.parse = dev_user_parse;
dev->devtype.alloc_data_buf = dev_user_alloc_data_buf;
dev->devtype.dev_alloc_data_buf = dev_user_alloc_data_buf;
dev->devtype.dev_done = NULL;
if (dev->parse_type != SCST_USER_PARSE_CALL) {
@@ -2993,7 +2993,7 @@ static int dev_user_register_dev(struct file *file,
dev->devtype.type = dev_desc->type;
dev->devtype.threads_num = -1;
dev->devtype.parse_atomic = 1;
dev->devtype.alloc_data_buf_atomic = 1;
dev->devtype.dev_alloc_data_buf_atomic = 1;
dev->devtype.dev_done_atomic = 1;
#ifdef CONFIG_SCST_PROC
dev->devtype.no_proc = 1;

View File

@@ -445,7 +445,7 @@ static struct scst_dev_type vdisk_file_devtype = {
.attach_tgt = vdisk_attach_tgt,
.detach_tgt = vdisk_detach_tgt,
.parse = vdisk_parse,
.alloc_data_buf = fileio_alloc_data_buf,
.dev_alloc_data_buf = fileio_alloc_data_buf,
.exec = vdisk_exec,
.on_free_cmd = fileio_on_free_cmd,
.task_mgmt_fn_done = vdisk_task_mgmt_fn_done,
@@ -553,7 +553,7 @@ static struct scst_dev_type vcdrom_devtype = {
.attach_tgt = vdisk_attach_tgt,
.detach_tgt = vdisk_detach_tgt,
.parse = vcdrom_parse,
.alloc_data_buf = fileio_alloc_data_buf,
.dev_alloc_data_buf = fileio_alloc_data_buf,
.exec = vcdrom_exec,
.on_free_cmd = fileio_on_free_cmd,
.task_mgmt_fn_done = vdisk_task_mgmt_fn_done,

View File

@@ -1478,7 +1478,7 @@ static int scst_set_lun_not_supported_request_sense(struct scst_cmd *cmd,
if (cmd->sg == NULL) {
/*
* If target driver preparing data buffer using alloc_data_buf()
* If target driver preparing data buffer using tgt_alloc_data_buf()
* callback, it is responsible to copy the sense to its buffer
* in xmit_response().
*/
@@ -1545,7 +1545,7 @@ static int scst_set_lun_not_supported_inquiry(struct scst_cmd *cmd)
if (cmd->sg == NULL) {
/*
* If target driver preparing data buffer using alloc_data_buf()
* If target driver preparing data buffer using tgt_alloc_data_buf()
* callback, it is responsible to copy the sense to its buffer
* in xmit_response().
*/
@@ -4124,7 +4124,7 @@ static int scst_alloc_add_tgt_dev(struct scst_session *sess,
tgt_dev->curr_order_data = &dev->dev_order_data;
if (dev->handler->parse_atomic &&
dev->handler->alloc_data_buf_atomic &&
dev->handler->dev_alloc_data_buf_atomic &&
(sess->tgt->tgtt->preprocessing_done == NULL)) {
if (sess->tgt->tgtt->rdy_to_xfer_atomic)
__set_bit(SCST_TGT_DEV_AFTER_INIT_WR_ATOMIC,

View File

@@ -1124,8 +1124,8 @@ static int scst_dev_handler_check(struct scst_dev_type *dev_handler)
}
#endif
if (dev_handler->alloc_data_buf == NULL)
dev_handler->alloc_data_buf_atomic = 1;
if (dev_handler->dev_alloc_data_buf == NULL)
dev_handler->dev_alloc_data_buf_atomic = 1;
if (dev_handler->dev_done == NULL)
dev_handler->dev_done_atomic = 1;

View File

@@ -63,9 +63,9 @@ void scst_post_parse(struct scst_cmd *cmd)
EXPORT_SYMBOL_GPL(scst_post_parse);
/**
* scst_post_alloc_data_buf() - do post alloc_data_buf actions
* scst_post_alloc_data_buf() - do post dev_alloc_data_buf actions
*
* This function must be called by dev handler after its alloc_data_buf()
* This function must be called by dev handler after its dev_alloc_data_buf()
* callback returned SCST_CMD_STATE_STOP before calling
* scst_process_active_cmd().
*/
@@ -971,46 +971,46 @@ static int scst_prepare_space(struct scst_cmd *cmd)
goto done;
if (likely((cmd->op_flags & SCST_FULLY_LOCAL_CMD) == 0) &&
(devt->alloc_data_buf != NULL)) {
(devt->dev_alloc_data_buf != NULL)) {
int state;
if (unlikely(!devt->alloc_data_buf_atomic &&
if (unlikely(!devt->dev_alloc_data_buf_atomic &&
scst_cmd_atomic(cmd))) {
/*
* It shouldn't be because of the SCST_TGT_DEV_AFTER_*
* optimization.
*/
TRACE_MGMT_DBG("Dev handler %s alloc_data_buf() needs "
"thread context, rescheduling",
TRACE_MGMT_DBG("Dev handler %s dev_alloc_data_buf() "
"needs thread context, rescheduling",
devt->name);
res = SCST_CMD_STATE_RES_NEED_THREAD;
goto out;
}
TRACE_DBG("Calling dev handler's %s alloc_data_buf(%p)",
TRACE_DBG("Calling dev handler's %s dev_alloc_data_buf(%p)",
devt->name, cmd);
scst_set_cur_start(cmd);
state = devt->alloc_data_buf(cmd);
state = devt->dev_alloc_data_buf(cmd);
/*
* Caution: cmd can be already dead here
*/
/* cmd can be already dead here, so we can't dereference devt */
TRACE_DBG("Dev handler %p alloc_data_buf() returned %d",
TRACE_DBG("Dev handler %p dev_alloc_data_buf() returned %d",
devt, state);
switch (state) {
case SCST_CMD_STATE_NEED_THREAD_CTX:
scst_set_alloc_buf_time(cmd);
TRACE_DBG("Dev handler %s alloc_data_buf() requested "
TRACE_DBG("Dev handler %s dev_alloc_data_buf() requested "
"thread context, rescheduling", devt->name);
res = SCST_CMD_STATE_RES_NEED_THREAD;
goto out;
case SCST_CMD_STATE_STOP:
/* cmd can be already dead here, so we can't deref devt */
TRACE_DBG("Dev handler %p alloc_data_buf() requested "
"stop processing", devt);
TRACE_DBG("Dev handler %p dev_alloc_data_buf() "
"requested stop processing", devt);
res = SCST_CMD_STATE_RES_CONT_NEXT;
goto out;
}
@@ -1026,11 +1026,11 @@ static int scst_prepare_space(struct scst_cmd *cmd)
if (cmd->tgt_need_alloc_data_buf) {
int orig_bufflen = cmd->bufflen;
TRACE_MEM("Custom tgt data buf allocation requested (cmd %p)",
cmd);
TRACE_MEM("Calling tgt %s tgt_alloc_data_buf(cmd %p)",
cmd->tgt->tgt_name, cmd);
scst_set_cur_start(cmd);
r = cmd->tgtt->alloc_data_buf(cmd);
r = cmd->tgtt->tgt_alloc_data_buf(cmd);
scst_set_alloc_buf_time(cmd);
if (r > 0)