From patchwork Tue May 5 11:55:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 11528875 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 718D615E6 for ; Tue, 5 May 2020 11:56:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4857B206A4 for ; Tue, 5 May 2020 11:56:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4857B206A4 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 398118E0058; 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 2FA048E00BF; 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 149108E00C0; 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 (smtprelay0102.hostedemail.com [216.40.44.102]) by kanga.kvack.org (Postfix) with ESMTP id E59AB8E00BF for ; Tue, 5 May 2020 07:56:08 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AA9428248D51 for ; Tue, 5 May 2020 11:56:08 +0000 (UTC) X-FDA: 76782512016.23.paper79_6fc7ddcafe92f X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,thunder.leizhen@huawei.com,,RULES_HIT:30012:30034:30054:30070,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:0,LUA_SUMMARY:none X-HE-Tag: paper79_6fc7ddcafe92f X-Filterd-Recvd-Size: 2677 Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Tue, 5 May 2020 11:56:07 +0000 (UTC) Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id D52B2ECE72F96FF1ABBA; 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:54 +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 0/4] eliminate SECTOR related magic numbers and duplicated conversions Date: Tue, 5 May 2020 19:55:39 +0800 Message-ID: <20200505115543.1660-1-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.26.0.windows.1 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: When I studied the code of mm/swap, I found "1 << (PAGE_SHIFT - 9)" appears many times. So I try to clean up it. 1. Replace "1 << (PAGE_SHIFT - 9)" or similar with SECTORS_PER_PAGE 2. Replace "PAGE_SHIFT - 9" with SECTORS_PER_PAGE_SHIFT 3. Replace "9" with SECTOR_SHIFT 4. Replace "512" with SECTOR_SIZE No functional change. Zhen Lei (4): block: Move SECTORS_PER_PAGE and SECTORS_PER_PAGE_SHIFT definitions into mm/swap: use SECTORS_PER_PAGE_SHIFT to clean up code block: use SECTORS_PER_PAGE_SHIFT and SECTORS_PER_PAGE to clean up code mtd: eliminate SECTOR related magic numbers block/blk-settings.c | 8 ++++---- block/partitions/core.c | 4 ++-- drivers/block/zram/zram_drv.h | 2 -- drivers/md/dm-table.c | 2 +- drivers/md/raid1.c | 4 ++-- drivers/md/raid10.c | 10 +++++----- drivers/md/raid5-cache.c | 10 +++++----- include/linux/blkdev.h | 10 ++++++++-- mm/page_io.c | 4 ++-- mm/swapfile.c | 12 ++++++------ 10 files changed, 35 insertions(+), 31 deletions(-)