diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-04-23 11:35:31 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2012-05-06 15:03:41 -0700 |
commit | 7a83aa4e7b26ba61b9dc98d5c0bf725f4df0043f (patch) | |
tree | dc2c7e29f7850e238e5f752aaeb4bbaa8dd69f94 /drivers/target | |
parent | 72a0e5e2e2e6b577343c79013611ad5701e94482 (diff) |
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>
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_file.c | 11 | ||||
-rw-r--r-- | drivers/target/target_core_iblock.c | 3 | ||||
-rw-r--r-- | drivers/target/target_core_pscsi.c | 6 | ||||
-rw-r--r-- | drivers/target/target_core_rd.c | 2 | ||||
-rw-r--r-- | drivers/target/target_core_transport.c | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 4343cfd68117..6667039250c0 100644 --- a/drivers/target/target_core_file.c +++ b/drivers/target/target_core_file.c @@ -300,10 +300,10 @@ static int fd_do_readv(struct se_task *task) * block_device. */ 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," " expecting %d for S_ISBLK\n", ret, - (int)task->task_size); + (int)task->task_se_cmd->data_length); return (ret < 0 ? ret : -EINVAL); } } else { @@ -348,7 +348,7 @@ static int fd_do_writev(struct se_task *task) 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); 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; loff_t start = task->task_se_cmd->t_task_lba * 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; 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); if (ret != 0) diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 311f43b3cffa..873440bf65f3 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c @@ -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:" " %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_private = task; diff --git a/drivers/target/target_core_pscsi.c b/drivers/target/target_core_pscsi.c index 94c7a4649632..46eb017287a6 100644 --- a/drivers/target/target_core_pscsi.c +++ b/drivers/target/target_core_pscsi.c @@ -967,8 +967,8 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg, struct bio *bio = NULL, *tbio = NULL; struct page *page; struct scatterlist *sg; - u32 data_len = task->task_size, i, len, bytes, off; - int nr_pages = (task->task_size + task_sg[0].offset + + u32 data_len = cmd->data_length, i, len, bytes, off; + int nr_pages = (cmd->data_length + task_sg[0].offset + PAGE_SIZE - 1) >> PAGE_SHIFT; int nr_vecs = 0, rc; int rw = (task->task_data_direction == DMA_TO_DEVICE); @@ -1085,7 +1085,7 @@ static int pscsi_do_task(struct se_task *task) return -ENODEV; } } else { - BUG_ON(!task->task_size); + BUG_ON(!cmd->data_length); /* * Setup the main struct request for the task->task_sg[] payload diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c index 0bec5729d073..c6ce46891be9 100644 --- a/drivers/target/target_core_rd.c +++ b/drivers/target/target_core_rd.c @@ -307,7 +307,7 @@ static int rd_do_task(struct se_task *task) se_dev->se_sub_dev->se_dev_attrib.block_size; rd_offset = do_div(tmp, PAGE_SIZE); rd_page = tmp; - rd_size = task->task_size; + rd_size = task->task_se_cmd->data_length; table = rd_get_sg_table(dev, rd_page); if (!table) diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 0fb3521d32d6..9c9c11dc307e 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -3722,7 +3722,6 @@ transport_allocate_data_tasks(struct se_cmd *cmd, task->task_sg = cmd_sg; task->task_sg_nents = sgl_nents; - task->task_size = cmd->data_length; task->task_sectors = sectors; @@ -3749,7 +3748,6 @@ transport_allocate_control_task(struct se_cmd *cmd) return -ENOMEM; task->task_sg = cmd->t_data_sg; - task->task_size = cmd->data_length; task->task_sg_nents = cmd->t_data_nents; spin_lock_irqsave(&cmd->t_state_lock, flags); |