mirror of https://gitee.com/openkylin/linux.git
target: remove the task_size field in struct se_task
Now that we don't split commands the size field in the task is always equivalent to the one in the CDB, even in cases where we have two tasks due to a BIDI transfer. Just refer the the size in the command instead of duplicating it in the task. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
parent
72a0e5e2e2
commit
7a83aa4e7b
|
@ -300,10 +300,10 @@ static int fd_do_readv(struct se_task *task)
|
||||||
* block_device.
|
* block_device.
|
||||||
*/
|
*/
|
||||||
if (S_ISBLK(fd->f_dentry->d_inode->i_mode)) {
|
if (S_ISBLK(fd->f_dentry->d_inode->i_mode)) {
|
||||||
if (ret < 0 || ret != task->task_size) {
|
if (ret < 0 || ret != task->task_se_cmd->data_length) {
|
||||||
pr_err("vfs_readv() returned %d,"
|
pr_err("vfs_readv() returned %d,"
|
||||||
" expecting %d for S_ISBLK\n", ret,
|
" expecting %d for S_ISBLK\n", ret,
|
||||||
(int)task->task_size);
|
(int)task->task_se_cmd->data_length);
|
||||||
return (ret < 0 ? ret : -EINVAL);
|
return (ret < 0 ? ret : -EINVAL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -348,7 +348,7 @@ static int fd_do_writev(struct se_task *task)
|
||||||
|
|
||||||
kfree(iov);
|
kfree(iov);
|
||||||
|
|
||||||
if (ret < 0 || ret != task->task_size) {
|
if (ret < 0 || ret != task->task_se_cmd->data_length) {
|
||||||
pr_err("vfs_writev() returned %d\n", ret);
|
pr_err("vfs_writev() returned %d\n", ret);
|
||||||
return (ret < 0 ? ret : -EINVAL);
|
return (ret < 0 ? ret : -EINVAL);
|
||||||
}
|
}
|
||||||
|
@ -404,11 +404,12 @@ static void fd_emulate_write_fua(struct se_cmd *cmd, struct se_task *task)
|
||||||
struct fd_dev *fd_dev = dev->dev_ptr;
|
struct fd_dev *fd_dev = dev->dev_ptr;
|
||||||
loff_t start = task->task_se_cmd->t_task_lba *
|
loff_t start = task->task_se_cmd->t_task_lba *
|
||||||
dev->se_sub_dev->se_dev_attrib.block_size;
|
dev->se_sub_dev->se_dev_attrib.block_size;
|
||||||
loff_t end = start + task->task_size;
|
loff_t end = start + task->task_se_cmd->data_length;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pr_debug("FILEIO: FUA WRITE LBA: %llu, bytes: %u\n",
|
pr_debug("FILEIO: FUA WRITE LBA: %llu, bytes: %u\n",
|
||||||
task->task_se_cmd->t_task_lba, task->task_size);
|
task->task_se_cmd->t_task_lba,
|
||||||
|
task->task_se_cmd->data_length);
|
||||||
|
|
||||||
ret = vfs_fsync_range(fd_dev->fd_file, start, end, 1);
|
ret = vfs_fsync_range(fd_dev->fd_file, start, end, 1);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
|
|
|
@ -478,7 +478,8 @@ iblock_get_bio(struct se_task *task, sector_t lba, u32 sg_num)
|
||||||
|
|
||||||
pr_debug("Allocated bio: %p task_sg_nents: %u using ibd_bio_set:"
|
pr_debug("Allocated bio: %p task_sg_nents: %u using ibd_bio_set:"
|
||||||
" %p\n", bio, task->task_sg_nents, ib_dev->ibd_bio_set);
|
" %p\n", bio, task->task_sg_nents, ib_dev->ibd_bio_set);
|
||||||
pr_debug("Allocated bio: %p task_size: %u\n", bio, task->task_size);
|
pr_debug("Allocated bio: %p task_size: %u\n", bio,
|
||||||
|
task->task_se_cmd->data_length);
|
||||||
|
|
||||||
bio->bi_bdev = ib_dev->ibd_bd;
|
bio->bi_bdev = ib_dev->ibd_bd;
|
||||||
bio->bi_private = task;
|
bio->bi_private = task;
|
||||||
|
|
|
@ -967,8 +967,8 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg,
|
||||||
struct bio *bio = NULL, *tbio = NULL;
|
struct bio *bio = NULL, *tbio = NULL;
|
||||||
struct page *page;
|
struct page *page;
|
||||||
struct scatterlist *sg;
|
struct scatterlist *sg;
|
||||||
u32 data_len = task->task_size, i, len, bytes, off;
|
u32 data_len = cmd->data_length, i, len, bytes, off;
|
||||||
int nr_pages = (task->task_size + task_sg[0].offset +
|
int nr_pages = (cmd->data_length + task_sg[0].offset +
|
||||||
PAGE_SIZE - 1) >> PAGE_SHIFT;
|
PAGE_SIZE - 1) >> PAGE_SHIFT;
|
||||||
int nr_vecs = 0, rc;
|
int nr_vecs = 0, rc;
|
||||||
int rw = (task->task_data_direction == DMA_TO_DEVICE);
|
int rw = (task->task_data_direction == DMA_TO_DEVICE);
|
||||||
|
@ -1085,7 +1085,7 @@ static int pscsi_do_task(struct se_task *task)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BUG_ON(!task->task_size);
|
BUG_ON(!cmd->data_length);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setup the main struct request for the task->task_sg[] payload
|
* Setup the main struct request for the task->task_sg[] payload
|
||||||
|
|
|
@ -307,7 +307,7 @@ static int rd_do_task(struct se_task *task)
|
||||||
se_dev->se_sub_dev->se_dev_attrib.block_size;
|
se_dev->se_sub_dev->se_dev_attrib.block_size;
|
||||||
rd_offset = do_div(tmp, PAGE_SIZE);
|
rd_offset = do_div(tmp, PAGE_SIZE);
|
||||||
rd_page = tmp;
|
rd_page = tmp;
|
||||||
rd_size = task->task_size;
|
rd_size = task->task_se_cmd->data_length;
|
||||||
|
|
||||||
table = rd_get_sg_table(dev, rd_page);
|
table = rd_get_sg_table(dev, rd_page);
|
||||||
if (!table)
|
if (!table)
|
||||||
|
|
|
@ -3722,7 +3722,6 @@ transport_allocate_data_tasks(struct se_cmd *cmd,
|
||||||
|
|
||||||
task->task_sg = cmd_sg;
|
task->task_sg = cmd_sg;
|
||||||
task->task_sg_nents = sgl_nents;
|
task->task_sg_nents = sgl_nents;
|
||||||
task->task_size = cmd->data_length;
|
|
||||||
|
|
||||||
task->task_sectors = sectors;
|
task->task_sectors = sectors;
|
||||||
|
|
||||||
|
@ -3749,7 +3748,6 @@ transport_allocate_control_task(struct se_cmd *cmd)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
task->task_sg = cmd->t_data_sg;
|
task->task_sg = cmd->t_data_sg;
|
||||||
task->task_size = cmd->data_length;
|
|
||||||
task->task_sg_nents = cmd->t_data_nents;
|
task->task_sg_nents = cmd->t_data_nents;
|
||||||
|
|
||||||
spin_lock_irqsave(&cmd->t_state_lock, flags);
|
spin_lock_irqsave(&cmd->t_state_lock, flags);
|
||||||
|
|
|
@ -487,7 +487,6 @@ struct se_queue_obj {
|
||||||
|
|
||||||
struct se_task {
|
struct se_task {
|
||||||
u32 task_sectors;
|
u32 task_sectors;
|
||||||
u32 task_size;
|
|
||||||
struct se_cmd *task_se_cmd;
|
struct se_cmd *task_se_cmd;
|
||||||
struct scatterlist *task_sg;
|
struct scatterlist *task_sg;
|
||||||
u32 task_sg_nents;
|
u32 task_sg_nents;
|
||||||
|
|
Loading…
Reference in New Issue