aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2012-04-23 11:35:30 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-05-06 18:02:59 -0400
commit72a0e5e2e2e6b577343c79013611ad5701e94482 (patch)
tree06e41f5240a98040a2a6eed30ab75c0c4213baf2 /drivers/target
parented3102c678c6274933948f9097bb4e2b314e5f82 (diff)
target: remove the task_lba field in struct se_task
Now that we don't split commands the lba 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 lba 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.c9
-rw-r--r--drivers/target/target_core_iblock.c10
-rw-r--r--drivers/target/target_core_rd.c6
-rw-r--r--drivers/target/target_core_transport.c1
4 files changed, 14 insertions, 12 deletions
diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index c3e899e551a5..4343cfd68117 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -273,7 +273,7 @@ static int fd_do_readv(struct se_task *task)
273 struct scatterlist *sg = task->task_sg; 273 struct scatterlist *sg = task->task_sg;
274 struct iovec *iov; 274 struct iovec *iov;
275 mm_segment_t old_fs; 275 mm_segment_t old_fs;
276 loff_t pos = (task->task_lba * 276 loff_t pos = (task->task_se_cmd->t_task_lba *
277 se_dev->se_sub_dev->se_dev_attrib.block_size); 277 se_dev->se_sub_dev->se_dev_attrib.block_size);
278 int ret = 0, i; 278 int ret = 0, i;
279 279
@@ -326,7 +326,7 @@ static int fd_do_writev(struct se_task *task)
326 struct scatterlist *sg = task->task_sg; 326 struct scatterlist *sg = task->task_sg;
327 struct iovec *iov; 327 struct iovec *iov;
328 mm_segment_t old_fs; 328 mm_segment_t old_fs;
329 loff_t pos = (task->task_lba * 329 loff_t pos = (task->task_se_cmd->t_task_lba *
330 se_dev->se_sub_dev->se_dev_attrib.block_size); 330 se_dev->se_sub_dev->se_dev_attrib.block_size);
331 int ret, i = 0; 331 int ret, i = 0;
332 332
@@ -402,12 +402,13 @@ static void fd_emulate_write_fua(struct se_cmd *cmd, struct se_task *task)
402{ 402{
403 struct se_device *dev = cmd->se_dev; 403 struct se_device *dev = cmd->se_dev;
404 struct fd_dev *fd_dev = dev->dev_ptr; 404 struct fd_dev *fd_dev = dev->dev_ptr;
405 loff_t start = task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size; 405 loff_t start = task->task_se_cmd->t_task_lba *
406 dev->se_sub_dev->se_dev_attrib.block_size;
406 loff_t end = start + task->task_size; 407 loff_t end = start + task->task_size;
407 int ret; 408 int ret;
408 409
409 pr_debug("FILEIO: FUA WRITE LBA: %llu, bytes: %u\n", 410 pr_debug("FILEIO: FUA WRITE LBA: %llu, bytes: %u\n",
410 task->task_lba, task->task_size); 411 task->task_se_cmd->t_task_lba, task->task_size);
411 412
412 ret = vfs_fsync_range(fd_dev->fd_file, start, end, 1); 413 ret = vfs_fsync_range(fd_dev->fd_file, start, end, 1);
413 if (ret != 0) 414 if (ret != 0)
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 2ec299e8a73e..311f43b3cffa 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -536,13 +536,13 @@ static int iblock_do_task(struct se_task *task)
536 * struct se_task SCSI blocksize into Linux/Block 512 units for BIO. 536 * struct se_task SCSI blocksize into Linux/Block 512 units for BIO.
537 */ 537 */
538 if (dev->se_sub_dev->se_dev_attrib.block_size == 4096) 538 if (dev->se_sub_dev->se_dev_attrib.block_size == 4096)
539 block_lba = (task->task_lba << 3); 539 block_lba = (cmd->t_task_lba << 3);
540 else if (dev->se_sub_dev->se_dev_attrib.block_size == 2048) 540 else if (dev->se_sub_dev->se_dev_attrib.block_size == 2048)
541 block_lba = (task->task_lba << 2); 541 block_lba = (cmd->t_task_lba << 2);
542 else if (dev->se_sub_dev->se_dev_attrib.block_size == 1024) 542 else if (dev->se_sub_dev->se_dev_attrib.block_size == 1024)
543 block_lba = (task->task_lba << 1); 543 block_lba = (cmd->t_task_lba << 1);
544 else if (dev->se_sub_dev->se_dev_attrib.block_size == 512) 544 else if (dev->se_sub_dev->se_dev_attrib.block_size == 512)
545 block_lba = task->task_lba; 545 block_lba = cmd->t_task_lba;
546 else { 546 else {
547 pr_err("Unsupported SCSI -> BLOCK LBA conversion:" 547 pr_err("Unsupported SCSI -> BLOCK LBA conversion:"
548 " %u\n", dev->se_sub_dev->se_dev_attrib.block_size); 548 " %u\n", dev->se_sub_dev->se_dev_attrib.block_size);
@@ -646,7 +646,7 @@ static void iblock_bio_done(struct bio *bio, int err)
646 return; 646 return;
647 647
648 pr_debug("done[%p] bio: %p task_lba: %llu bio_lba: %llu err=%d\n", 648 pr_debug("done[%p] bio: %p task_lba: %llu bio_lba: %llu err=%d\n",
649 task, bio, task->task_lba, 649 task, bio, task->task_se_cmd->t_task_lba,
650 (unsigned long long)bio->bi_sector, err); 650 (unsigned long long)bio->bi_sector, err);
651 651
652 transport_complete_task(task, !atomic_read(&ibr->ib_bio_err_cnt)); 652 transport_complete_task(task, !atomic_read(&ibr->ib_bio_err_cnt));
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
index 35c64d1e09d9..0bec5729d073 100644
--- a/drivers/target/target_core_rd.c
+++ b/drivers/target/target_core_rd.c
@@ -303,7 +303,8 @@ static int rd_do_task(struct se_task *task)
303 u32 src_len; 303 u32 src_len;
304 u64 tmp; 304 u64 tmp;
305 305
306 tmp = task->task_lba * se_dev->se_sub_dev->se_dev_attrib.block_size; 306 tmp = task->task_se_cmd->t_task_lba *
307 se_dev->se_sub_dev->se_dev_attrib.block_size;
307 rd_offset = do_div(tmp, PAGE_SIZE); 308 rd_offset = do_div(tmp, PAGE_SIZE);
308 rd_page = tmp; 309 rd_page = tmp;
309 rd_size = task->task_size; 310 rd_size = task->task_size;
@@ -318,7 +319,8 @@ static int rd_do_task(struct se_task *task)
318 dev->rd_dev_id, 319 dev->rd_dev_id,
319 task->task_data_direction == DMA_FROM_DEVICE ? 320 task->task_data_direction == DMA_FROM_DEVICE ?
320 "Read" : "Write", 321 "Read" : "Write",
321 task->task_lba, rd_size, rd_page, rd_offset); 322 task->task_se_cmd->t_task_lba,
323 rd_size, rd_page, rd_offset);
322 324
323 src_len = PAGE_SIZE - rd_offset; 325 src_len = PAGE_SIZE - rd_offset;
324 sg_miter_start(&m, task->task_sg, task->task_sg_nents, 326 sg_miter_start(&m, task->task_sg, task->task_sg_nents,
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 2b84521fa0b4..0fb3521d32d6 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -3724,7 +3724,6 @@ transport_allocate_data_tasks(struct se_cmd *cmd,
3724 task->task_sg_nents = sgl_nents; 3724 task->task_sg_nents = sgl_nents;
3725 task->task_size = cmd->data_length; 3725 task->task_size = cmd->data_length;
3726 3726
3727 task->task_lba = cmd->t_task_lba;
3728 task->task_sectors = sectors; 3727 task->task_sectors = sectors;
3729 3728
3730 spin_lock_irqsave(&cmd->t_state_lock, flags); 3729 spin_lock_irqsave(&cmd->t_state_lock, flags);