public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bio: use offset_in_page macro
@ 2015-11-21  9:27 Geliang Tang
  2015-11-24  3:23 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Geliang Tang @ 2015-11-21  9:27 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Geliang Tang, linux-block, linux-kernel

Use offset_in_page macro instead of (addr & ~PAGE_MASK).

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 block/bio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/bio.c b/block/bio.c
index 4f184d9..dbabd48 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1125,7 +1125,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
 	int i, ret;
 	int nr_pages = 0;
 	unsigned int len = iter->count;
-	unsigned int offset = map_data ? map_data->offset & ~PAGE_MASK : 0;
+	unsigned int offset = map_data ? offset_in_page(map_data->offset) : 0;
 
 	for (i = 0; i < iter->nr_segs; i++) {
 		unsigned long uaddr;
@@ -1304,7 +1304,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
 			goto out_unmap;
 		}
 
-		offset = uaddr & ~PAGE_MASK;
+		offset = offset_in_page(uaddr);
 		for (j = cur_page; j < page_limit; j++) {
 			unsigned int bytes = PAGE_SIZE - offset;
 
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] bio: use offset_in_page macro
  2015-11-21  9:27 [PATCH] bio: use offset_in_page macro Geliang Tang
@ 2015-11-24  3:23 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2015-11-24  3:23 UTC (permalink / raw)
  To: Geliang Tang; +Cc: linux-block, linux-kernel

On 11/21/2015 02:27 AM, Geliang Tang wrote:
> Use offset_in_page macro instead of (addr & ~PAGE_MASK).

Added for 4.5, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-11-24  3:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-21  9:27 [PATCH] bio: use offset_in_page macro Geliang Tang
2015-11-24  3:23 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox