Ejemplo n.º 1
0
/*	rd_MEMCPY_do_task(): (Part of se_subsystem_api_t template)
 *
 *
 */
static int rd_MEMCPY_do_task(struct se_task *task)
{
	struct se_device *dev = task->task_se_cmd->se_dev;
	struct rd_request *req = RD_REQ(task);
	unsigned long long lba;
	int ret;

	req->rd_page = (task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size) / PAGE_SIZE;
	lba = task->task_lba;
	req->rd_offset = (do_div(lba,
			  (PAGE_SIZE / dev->se_sub_dev->se_dev_attrib.block_size))) *
			   dev->se_sub_dev->se_dev_attrib.block_size;
	req->rd_size = task->task_size;

	if (task->task_data_direction == DMA_FROM_DEVICE)
		ret = rd_MEMCPY_read(req);
	else
		ret = rd_MEMCPY_write(req);

	if (ret != 0)
		return ret;

	task->task_scsi_status = GOOD;
	transport_complete_task(task, 1);

	return PYX_TRANSPORT_SENT_TO_TRANSPORT;
}
Ejemplo n.º 2
0
/*	rd_MEMCPY_do_task(): (Part of se_subsystem_api_t template)
 *
 *
 */
static int rd_MEMCPY_do_task(struct se_task *task)
{
	struct se_device *dev = task->task_se_cmd->se_dev;
	struct rd_request *req = RD_REQ(task);
	u64 tmp;
	int ret;

	tmp = task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size;
	req->rd_offset = do_div(tmp, PAGE_SIZE);
	req->rd_page = tmp;
	req->rd_size = task->task_size;

	ret = rd_MEMCPY(req, task->task_data_direction == DMA_FROM_DEVICE);
	if (ret != 0)
		return ret;

	task->task_scsi_status = GOOD;
	transport_complete_task(task, 1);
	return 0;
}
Ejemplo n.º 3
0
static int fd_do_task(struct se_task *task)
{
	struct se_cmd *cmd = task->task_se_cmd;
	struct se_device *dev = cmd->se_dev;
	int ret = 0;

	/*
	 * Call vectorized fileio functions to map struct scatterlist
	 * physical memory addresses to struct iovec virtual memory.
	 */
	if (task->task_data_direction == DMA_FROM_DEVICE) {
		ret = fd_do_readv(task);
	} else {
		ret = fd_do_writev(task);

		if (ret > 0 &&
		    dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0 &&
		    dev->se_sub_dev->se_dev_attrib.emulate_fua_write > 0 &&
		    cmd->t_tasks_fua) {
			/*
			 * We might need to be a bit smarter here
			 * and return some sense data to let the initiator
			 * know the FUA WRITE cache sync failed..?
			 */
			fd_emulate_write_fua(cmd, task);
		}

	}

	if (ret < 0)
		return ret;
	if (ret) {
		task->task_scsi_status = GOOD;
		transport_complete_task(task, 1);
	}
	return PYX_TRANSPORT_SENT_TO_TRANSPORT;
}