Commit b75d8063 authored by Geliang Tang's avatar Geliang Tang Committed by Nicholas Bellinger

target: use offset_in_page macro

Use offset_in_page macro instead of (addr & ~PAGE_MASK).
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 234bdbc4
...@@ -194,7 +194,7 @@ static struct tcmu_cmd *tcmu_alloc_cmd(struct se_cmd *se_cmd) ...@@ -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) 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); size = round_up(size+offset, PAGE_SIZE);
vaddr -= offset; vaddr -= offset;
......
...@@ -154,9 +154,9 @@ int ft_queue_data_in(struct se_cmd *se_cmd) ...@@ -154,9 +154,9 @@ int ft_queue_data_in(struct se_cmd *se_cmd)
BUG_ON(!page); BUG_ON(!page);
from = kmap_atomic(page + (mem_off >> PAGE_SHIFT)); from = kmap_atomic(page + (mem_off >> PAGE_SHIFT));
page_addr = from; page_addr = from;
from += mem_off & ~PAGE_MASK; from += offset_in_page(mem_off);
tlen = min(tlen, (size_t)(PAGE_SIZE - tlen = min(tlen, (size_t)(PAGE_SIZE -
(mem_off & ~PAGE_MASK))); offset_in_page(mem_off)));
memcpy(to, from, tlen); memcpy(to, from, tlen);
kunmap_atomic(page_addr); kunmap_atomic(page_addr);
to += tlen; to += tlen;
...@@ -314,9 +314,9 @@ void ft_recv_write_data(struct ft_cmd *cmd, struct fc_frame *fp) ...@@ -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)); to = kmap_atomic(page + (mem_off >> PAGE_SHIFT));
page_addr = to; page_addr = to;
to += mem_off & ~PAGE_MASK; to += offset_in_page(mem_off);
tlen = min(tlen, (size_t)(PAGE_SIZE - tlen = min(tlen, (size_t)(PAGE_SIZE -
(mem_off & ~PAGE_MASK))); offset_in_page(mem_off)));
memcpy(to, from, tlen); memcpy(to, from, tlen);
kunmap_atomic(page_addr); kunmap_atomic(page_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment