From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhen Lei Subject: [PATCH v2 03/10] block: add sectors_to_npage()/npage_to_sectors() helpers Date: Thu, 7 May 2020 15:50:53 +0800 Message-ID: <20200507075100.1779-4-thunder.leizhen@huawei.com> References: <20200507075100.1779-1-thunder.leizhen@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT Return-path: In-Reply-To: <20200507075100.1779-1-thunder.leizhen@huawei.com> Sender: linux-block-owner@vger.kernel.org To: Minchan Kim , Nitin Gupta , Sergey Senozhatsky , Matthew Wilcox , Jens Axboe , Coly Li , Kent Overstreet , Alasdair Kergon , Mike Snitzer , linux-block , Andrew Morton , linux-mm , dm-devel , Song Liu , linux-raid , linux-kernel Cc: Zhen Lei List-Id: linux-raid.ids Provide the conversion of "number of sectors"/"sector number" and "number of pages"/"page number". Suggested-by: Matthew Wilcox Signed-off-by: Zhen Lei --- 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