aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2011-11-25 16:18:45 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2011-12-06 01:00:57 -0500
commit5bff9e8584fbcdb361dada5a0425724b9e31e608 (patch)
treea16f405f1165e03f0bf7a8d6053aa772b8545a5d /drivers
parent6f21475576dde397cd2580262209d4080fbd5458 (diff)
target/rd: simplify the page/offset computation
Breakout rd_MEMCPY_do_task() usage of do_div() to tmp value during rd_request->rd_page assignment. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/target/target_core_rd.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/target/target_core_rd.c b/drivers/target/target_core_rd.c
index 6d8a6881cfff..6119ed5a3311 100644
--- a/drivers/target/target_core_rd.c
+++ b/drivers/target/target_core_rd.c
@@ -583,14 +583,12 @@ static int rd_MEMCPY_do_task(struct se_task *task)
583{ 583{
584 struct se_device *dev = task->task_se_cmd->se_dev; 584 struct se_device *dev = task->task_se_cmd->se_dev;
585 struct rd_request *req = RD_REQ(task); 585 struct rd_request *req = RD_REQ(task);
586 unsigned long long lba; 586 u64 tmp;
587 int ret; 587 int ret;
588 588
589 req->rd_page = (task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size) / PAGE_SIZE; 589 tmp = task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size;
590 lba = task->task_lba; 590 req->rd_offset = do_div(tmp, PAGE_SIZE);
591 req->rd_offset = (do_div(lba, 591 req->rd_page = tmp;
592 (PAGE_SIZE / dev->se_sub_dev->se_dev_attrib.block_size))) *
593 dev->se_sub_dev->se_dev_attrib.block_size;
594 req->rd_size = task->task_size; 592 req->rd_size = task->task_size;
595 593
596 if (task->task_data_direction == DMA_FROM_DEVICE) 594 if (task->task_data_direction == DMA_FROM_DEVICE)