Skip to content

Commit 7a83aa4

Browse files
Christoph HellwigNicholas Bellinger
authored andcommitted
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 <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent 72a0e5e commit 7a83aa4

File tree

6 files changed

+12
-13
lines changed

6 files changed

+12
-13
lines changed

drivers/target/target_core_file.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,10 @@ static int fd_do_readv(struct se_task *task)
300300
* block_device.
301301
*/
302302
if (S_ISBLK(fd->f_dentry->d_inode->i_mode)) {
303-
if (ret < 0 || ret != task->task_size) {
303+
if (ret < 0 || ret != task->task_se_cmd->data_length) {
304304
pr_err("vfs_readv() returned %d,"
305305
" expecting %d for S_ISBLK\n", ret,
306-
(int)task->task_size);
306+
(int)task->task_se_cmd->data_length);
307307
return (ret < 0 ? ret : -EINVAL);
308308
}
309309
} else {
@@ -348,7 +348,7 @@ static int fd_do_writev(struct se_task *task)
348348

349349
kfree(iov);
350350

351-
if (ret < 0 || ret != task->task_size) {
351+
if (ret < 0 || ret != task->task_se_cmd->data_length) {
352352
pr_err("vfs_writev() returned %d\n", ret);
353353
return (ret < 0 ? ret : -EINVAL);
354354
}
@@ -404,11 +404,12 @@ static void fd_emulate_write_fua(struct se_cmd *cmd, struct se_task *task)
404404
struct fd_dev *fd_dev = dev->dev_ptr;
405405
loff_t start = task->task_se_cmd->t_task_lba *
406406
dev->se_sub_dev->se_dev_attrib.block_size;
407-
loff_t end = start + task->task_size;
407+
loff_t end = start + task->task_se_cmd->data_length;
408408
int ret;
409409

410410
pr_debug("FILEIO: FUA WRITE LBA: %llu, bytes: %u\n",
411-
task->task_se_cmd->t_task_lba, task->task_size);
411+
task->task_se_cmd->t_task_lba,
412+
task->task_se_cmd->data_length);
412413

413414
ret = vfs_fsync_range(fd_dev->fd_file, start, end, 1);
414415
if (ret != 0)

drivers/target/target_core_iblock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,8 @@ iblock_get_bio(struct se_task *task, sector_t lba, u32 sg_num)
478478

479479
pr_debug("Allocated bio: %p task_sg_nents: %u using ibd_bio_set:"
480480
" %p\n", bio, task->task_sg_nents, ib_dev->ibd_bio_set);
481-
pr_debug("Allocated bio: %p task_size: %u\n", bio, task->task_size);
481+
pr_debug("Allocated bio: %p task_size: %u\n", bio,
482+
task->task_se_cmd->data_length);
482483

483484
bio->bi_bdev = ib_dev->ibd_bd;
484485
bio->bi_private = task;

drivers/target/target_core_pscsi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -967,8 +967,8 @@ static int pscsi_map_sg(struct se_task *task, struct scatterlist *task_sg,
967967
struct bio *bio = NULL, *tbio = NULL;
968968
struct page *page;
969969
struct scatterlist *sg;
970-
u32 data_len = task->task_size, i, len, bytes, off;
971-
int nr_pages = (task->task_size + task_sg[0].offset +
970+
u32 data_len = cmd->data_length, i, len, bytes, off;
971+
int nr_pages = (cmd->data_length + task_sg[0].offset +
972972
PAGE_SIZE - 1) >> PAGE_SHIFT;
973973
int nr_vecs = 0, rc;
974974
int rw = (task->task_data_direction == DMA_TO_DEVICE);
@@ -1085,7 +1085,7 @@ static int pscsi_do_task(struct se_task *task)
10851085
return -ENODEV;
10861086
}
10871087
} else {
1088-
BUG_ON(!task->task_size);
1088+
BUG_ON(!cmd->data_length);
10891089

10901090
/*
10911091
* Setup the main struct request for the task->task_sg[] payload

drivers/target/target_core_rd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ static int rd_do_task(struct se_task *task)
307307
se_dev->se_sub_dev->se_dev_attrib.block_size;
308308
rd_offset = do_div(tmp, PAGE_SIZE);
309309
rd_page = tmp;
310-
rd_size = task->task_size;
310+
rd_size = task->task_se_cmd->data_length;
311311

312312
table = rd_get_sg_table(dev, rd_page);
313313
if (!table)

drivers/target/target_core_transport.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3722,7 +3722,6 @@ transport_allocate_data_tasks(struct se_cmd *cmd,
37223722

37233723
task->task_sg = cmd_sg;
37243724
task->task_sg_nents = sgl_nents;
3725-
task->task_size = cmd->data_length;
37263725

37273726
task->task_sectors = sectors;
37283727

@@ -3749,7 +3748,6 @@ transport_allocate_control_task(struct se_cmd *cmd)
37493748
return -ENOMEM;
37503749

37513750
task->task_sg = cmd->t_data_sg;
3752-
task->task_size = cmd->data_length;
37533751
task->task_sg_nents = cmd->t_data_nents;
37543752

37553753
spin_lock_irqsave(&cmd->t_state_lock, flags);

include/target/target_core_base.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,6 @@ struct se_queue_obj {
487487

488488
struct se_task {
489489
u32 task_sectors;
490-
u32 task_size;
491490
struct se_cmd *task_se_cmd;
492491
struct scatterlist *task_sg;
493492
u32 task_sg_nents;

0 commit comments

Comments
 (0)