From patchwork Tue May 5 11:55:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 11528881 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7644D1668 for ; Tue, 5 May 2020 11:56:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4D436206A5 for ; Tue, 5 May 2020 11:56:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D436206A5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DD5278E00BF; Tue, 5 May 2020 07:56:09 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D59B58E00C3; Tue, 5 May 2020 07:56:09 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE6038E00BF; Tue, 5 May 2020 07:56:09 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 89ED48E00C0 for ; Tue, 5 May 2020 07:56:09 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4C5D38248D51 for ; Tue, 5 May 2020 11:56:09 +0000 (UTC) X-FDA: 76782512058.29.army90_6fd64e809ba2f X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,thunder.leizhen@huawei.com,,RULES_HIT:30012:30054,0,RBL:45.249.212.191:@huawei.com:.lbl8.mailshell.net-64.95.201.95 62.18.2.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: army90_6fd64e809ba2f X-Filterd-Recvd-Size: 3286 Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Tue, 5 May 2020 11:56:08 +0000 (UTC) Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id DB54372B6C5ABD53585B; Tue, 5 May 2020 19:56:03 +0800 (CST) Received: from DESKTOP-C3MD9UG.china.huawei.com (10.166.215.55) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Tue, 5 May 2020 19:55:55 +0800 From: Zhen Lei To: Minchan Kim , Nitin Gupta , "Sergey Senozhatsky" , Jens Axboe , linux-block , Andrew Morton , linux-mm , Alasdair Kergon , Mike Snitzer , dm-devel , Song Liu , linux-raid , linux-kernel CC: Zhen Lei Subject: [PATCH 1/4] block: Move SECTORS_PER_PAGE and SECTORS_PER_PAGE_SHIFT definitions into Date: Tue, 5 May 2020 19:55:40 +0800 Message-ID: <20200505115543.1660-2-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20200505115543.1660-1-thunder.leizhen@huawei.com> References: <20200505115543.1660-1-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.166.215.55] X-CFilter-Loop: Reflected X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This is similar to commit 233bde21a ("block: Move SECTOR_SIZE and SECTOR_SHIFT definitions into "), prepare to clear dozens of duplicated codes. Signed-off-by: Zhen Lei --- drivers/block/zram/zram_drv.h | 2 -- include/linux/blkdev.h | 10 ++++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h index f2fd46daa760..12309175d55e 100644 --- a/drivers/block/zram/zram_drv.h +++ b/drivers/block/zram/zram_drv.h @@ -21,8 +21,6 @@ #include "zcomp.h" -#define SECTORS_PER_PAGE_SHIFT (PAGE_SHIFT - SECTOR_SHIFT) -#define SECTORS_PER_PAGE (1 << SECTORS_PER_PAGE_SHIFT) #define ZRAM_LOGICAL_BLOCK_SHIFT 12 #define ZRAM_LOGICAL_BLOCK_SIZE (1 << ZRAM_LOGICAL_BLOCK_SHIFT) #define ZRAM_SECTOR_PER_LOGICAL_BLOCK \ diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 32868fbedc9e..a752e1c80bf0 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -904,10 +904,16 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev) * multiple of 512 bytes. Hence these two constants. */ #ifndef SECTOR_SHIFT -#define SECTOR_SHIFT 9 +#define SECTOR_SHIFT 9 #endif #ifndef SECTOR_SIZE -#define SECTOR_SIZE (1 << SECTOR_SHIFT) +#define SECTOR_SIZE (1 << SECTOR_SHIFT) +#endif +#ifndef SECTORS_PER_PAGE_SHIFT +#define SECTORS_PER_PAGE_SHIFT (PAGE_SHIFT - SECTOR_SHIFT) +#endif +#ifndef SECTORS_PER_PAGE +#define SECTORS_PER_PAGE (1 << SECTORS_PER_PAGE_SHIFT) #endif /*