From mboxrd@z Thu Jan 1 00:00:00 1970 From: antlists Subject: Re: [PATCH 0/4] eliminate SECTOR related magic numbers and duplicated conversions Date: Tue, 5 May 2020 18:32:36 +0100 Message-ID: References: <20200505115543.1660-1-thunder.leizhen@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20200505115543.1660-1-thunder.leizhen@huawei.com> Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org To: Zhen Lei , 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 List-Id: linux-raid.ids On 05/05/2020 12:55, Zhen Lei wrote: > 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 Naive question - what is happening about 4096-byte sectors? Do we need to forward-plan? Cheers, Wol