Skip to content

Commit

Permalink
target: use offset_in_page macro
Browse files Browse the repository at this point in the history
Use offset_in_page macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Geliang Tang authored and Nicholas Bellinger committed Jan 6, 2016
1 parent 234bdbc commit b75d806
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion drivers/target/target_core_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static struct tcmu_cmd *tcmu_alloc_cmd(struct se_cmd *se_cmd)

static inline void tcmu_flush_dcache_range(void *vaddr, size_t size)
{
unsigned long offset = (unsigned long) vaddr & ~PAGE_MASK;
unsigned long offset = offset_in_page(vaddr);

size = round_up(size+offset, PAGE_SIZE);
vaddr -= offset;
Expand Down
8 changes: 4 additions & 4 deletions drivers/target/tcm_fc/tfc_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ int ft_queue_data_in(struct se_cmd *se_cmd)
BUG_ON(!page);
from = kmap_atomic(page + (mem_off >> PAGE_SHIFT));
page_addr = from;
from += mem_off & ~PAGE_MASK;
from += offset_in_page(mem_off);
tlen = min(tlen, (size_t)(PAGE_SIZE -
(mem_off & ~PAGE_MASK)));
offset_in_page(mem_off)));
memcpy(to, from, tlen);
kunmap_atomic(page_addr);
to += tlen;
Expand Down Expand Up @@ -314,9 +314,9 @@ void ft_recv_write_data(struct ft_cmd *cmd, struct fc_frame *fp)

to = kmap_atomic(page + (mem_off >> PAGE_SHIFT));
page_addr = to;
to += mem_off & ~PAGE_MASK;
to += offset_in_page(mem_off);
tlen = min(tlen, (size_t)(PAGE_SIZE -
(mem_off & ~PAGE_MASK)));
offset_in_page(mem_off)));
memcpy(to, from, tlen);
kunmap_atomic(page_addr);

Expand Down

0 comments on commit b75d806

Please sign in to comment.