From patchwork Thu May 7 07:50:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 11532727 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 D7B5A14B4 for ; Thu, 7 May 2020 07:56:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A504E2080D for ; Thu, 7 May 2020 07:56:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A504E2080D 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 3EF9B900005; Thu, 7 May 2020 03:56:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3C67A900002; Thu, 7 May 2020 03:56:03 -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 2DE42900005; Thu, 7 May 2020 03:56:03 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0096.hostedemail.com [216.40.44.96]) by kanga.kvack.org (Postfix) with ESMTP id 17499900002 for ; Thu, 7 May 2020 03:56:03 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id D39478248D51 for ; Thu, 7 May 2020 07:56:02 +0000 (UTC) X-FDA: 76789164564.07.sand41_17902600f0c36 X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,thunder.leizhen@huawei.com,,RULES_HIT:30054:30090,0,RBL:45.249.212.32:@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: sand41_17902600f0c36 X-Filterd-Recvd-Size: 3534 Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Thu, 7 May 2020 07:56:01 +0000 (UTC) Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 708B77979A8DA881C073; Thu, 7 May 2020 15:55:53 +0800 (CST) Received: from DESKTOP-C3MD9UG.china.huawei.com (10.166.215.55) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Thu, 7 May 2020 15:55:46 +0800 From: Zhen Lei 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 Subject: [PATCH v2 02/10] zram: abolish macro SECTORS_PER_PAGE Date: Thu, 7 May 2020 15:50:52 +0800 Message-ID: <20200507075100.1779-3-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 In-Reply-To: <20200507075100.1779-1-thunder.leizhen@huawei.com> References: <20200507075100.1779-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: SECTORS_PER_PAGE is equivalent to PAGE_SECTORS. Although I prefer SECTORS_PER_PAGE better than PAGE_SECTORS, the former is more clearer, I think. But the latter was defined in before, rename it may impact users. Signed-off-by: Zhen Lei --- drivers/block/zram/zram_drv.c | 4 ++-- drivers/block/zram/zram_drv.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index ebb234f36909..e2fbf7a847e7 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1551,7 +1551,7 @@ static void __zram_make_request(struct zram *zram, struct bio *bio) index = bio->bi_iter.bi_sector >> SECTORS_PER_PAGE_SHIFT; offset = (bio->bi_iter.bi_sector & - (SECTORS_PER_PAGE - 1)) << SECTOR_SHIFT; + (PAGE_SECTORS - 1)) << SECTOR_SHIFT; switch (bio_op(bio)) { case REQ_OP_DISCARD: @@ -1645,7 +1645,7 @@ static int zram_rw_page(struct block_device *bdev, sector_t sector, } index = sector >> SECTORS_PER_PAGE_SHIFT; - offset = (sector & (SECTORS_PER_PAGE - 1)) << SECTOR_SHIFT; + offset = (sector & (PAGE_SECTORS - 1)) << SECTOR_SHIFT; bv.bv_page = page; bv.bv_len = PAGE_SIZE; diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h index f2fd46daa760..10fdf413dd6e 100644 --- a/drivers/block/zram/zram_drv.h +++ b/drivers/block/zram/zram_drv.h @@ -22,7 +22,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 \