From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32CA3C47247 for ; Tue, 5 May 2020 17:32:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 19566206FA for ; Tue, 5 May 2020 17:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730659AbgEERcj (ORCPT ); Tue, 5 May 2020 13:32:39 -0400 Received: from smtp.hosts.co.uk ([85.233.160.19]:46352 "EHLO smtp.hosts.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729709AbgEERcj (ORCPT ); Tue, 5 May 2020 13:32:39 -0400 Received: from [81.153.126.158] (helo=[192.168.1.225]) by smtp.hosts.co.uk with esmtpa (Exim) (envelope-from ) id 1jW1Qq-0006Ej-Em; Tue, 05 May 2020 18:32:36 +0100 Subject: Re: [PATCH 0/4] eliminate SECTOR related magic numbers and duplicated conversions 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 References: <20200505115543.1660-1-thunder.leizhen@huawei.com> From: antlists Message-ID: Date: Tue, 5 May 2020 18:32:36 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200505115543.1660-1-thunder.leizhen@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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