Skip to content

Commit

Permalink
target/rd: simplify the page/offset computation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sebastian Andrzej Siewior authored and Nicholas Bellinger committed Dec 6, 2011
1 parent 6f21475 commit 5bff9e8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/target/target_core_rd.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,14 +583,12 @@ static int rd_MEMCPY_do_task(struct se_task *task)
{
struct se_device *dev = task->task_se_cmd->se_dev;
struct rd_request *req = RD_REQ(task);
unsigned long long lba;
u64 tmp;
int ret;

req->rd_page = (task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size) / PAGE_SIZE;
lba = task->task_lba;
req->rd_offset = (do_div(lba,
(PAGE_SIZE / dev->se_sub_dev->se_dev_attrib.block_size))) *
dev->se_sub_dev->se_dev_attrib.block_size;
tmp = task->task_lba * dev->se_sub_dev->se_dev_attrib.block_size;
req->rd_offset = do_div(tmp, PAGE_SIZE);
req->rd_page = tmp;
req->rd_size = task->task_size;

if (task->task_data_direction == DMA_FROM_DEVICE)
Expand Down

0 comments on commit 5bff9e8

Please sign in to comment.