[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200507075100.1779-4-thunder.leizhen@huawei.com>
Date: Thu, 7 May 2020 15:50:53 +0800
From: Zhen Lei <thunder.leizhen@...wei.com>
To: Minchan Kim <minchan@...nel.org>, Nitin Gupta <ngupta@...are.org>,
"Sergey Senozhatsky" <sergey.senozhatsky.work@...il.com>,
Matthew Wilcox <willy@...radead.org>,
Jens Axboe <axboe@...nel.dk>, Coly Li <colyli@...e.de>,
Kent Overstreet <kent.overstreet@...il.com>,
"Alasdair Kergon" <agk@...hat.com>,
Mike Snitzer <snitzer@...hat.com>,
linux-block <linux-block@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-mm <linux-mm@...ck.org>, dm-devel <dm-devel@...hat.com>,
Song Liu <song@...nel.org>,
linux-raid <linux-raid@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
CC: Zhen Lei <thunder.leizhen@...wei.com>
Subject: [PATCH v2 03/10] block: add sectors_to_npage()/npage_to_sectors() helpers
Provide the conversion of "number of sectors"/"sector number" and
"number of pages"/"page number".
Suggested-by: Matthew Wilcox <willy@...radead.org>
Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
---
include/linux/blkdev.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 934f31fc15cd..5d8daaffc38b 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -910,6 +910,8 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev)
#define SECTOR_SIZE (1 << SECTOR_SHIFT)
#endif
#define PAGE_SECTORS (PAGE_SIZE / SECTOR_SIZE)
+#define sectors_to_npage(nr) ((nr) / PAGE_SECTORS)
+#define npage_to_sectors(nr) ((nr) * PAGE_SECTORS)
/*
* blk_rq_pos() : the current sector
--
2.26.0.106.g9fadedd
Powered by blists - more mailing lists