]> git.karo-electronics.de Git - linux-beck.git/commitdiff
target: remove the task_size field in struct se_task
authorChristoph Hellwig <hch@infradead.org>
Mon, 23 Apr 2012 15:35:31 +0000 (11:35 -0400)
committerNicholas Bellinger <nab@linux-iscsi.org>
Sun, 6 May 2012 22:03:41 +0000 (15:03 -0700)
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>
drivers/target/target_core_file.c
drivers/target/target_core_iblock.c
drivers/target/target_core_pscsi.c
drivers/target/target_core_rd.c
drivers/target/target_core_transport.c
include/target/target_core_base.h

index 4343cfd681173fc43caff4e9cbe867657f9ad3bd..6667039250c0bc4dd428d10975f8a18208b45bd3 100644 (file)
@@ -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)
index 311f43b3cffa17da28d67a5ae43667cada8c9332..873440bf65f3e02f9998640b0bd7912661a54e12 100644 (file)
@@ -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;
index 94c7a464963260b302d6d4ed6ce08b119d1e1f60..46eb017287a619c7c211bfc356a7285da8d44582 100644 (file)
@@ -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
index 0bec5729d073fca5142d37abe4bf3c8d04275f76..c6ce46891be9952d75a5286e81e814c4dd76c432 100644 (file)
@@ -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)
index 0fb3521d32d6c7f8e29cfa2cbf38570340d7af41..9c9c11dc307eeb4d4beb9b4d6c7d0db0f7d9b52c 100644 (file)
@@ -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);
index df5a4671c82d606e92826e73cb2eacde47eade26..5a4249d84040bb0559ab3d67a53827206e9e8a78 100644 (file)
@@ -487,7 +487,6 @@ struct se_queue_obj {
 
 struct se_task {
        u32                     task_sectors;
-       u32                     task_size;
        struct se_cmd           *task_se_cmd;
        struct scatterlist      *task_sg;
        u32                     task_sg_nents;