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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 6AAC5C433E1 for ; Fri, 15 May 2020 04:19:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2C9E4206F4 for ; Fri, 15 May 2020 04:19:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="B+hdZiy3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C9E4206F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E9BB190000C; Fri, 15 May 2020 00:19:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E24DC8E0005; Fri, 15 May 2020 00:19:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D137790000C; Fri, 15 May 2020 00:19:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0215.hostedemail.com [216.40.44.215]) by kanga.kvack.org (Postfix) with ESMTP id B67268E0005 for ; Fri, 15 May 2020 00:19:29 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 73D594DB8 for ; Fri, 15 May 2020 04:19:29 +0000 (UTC) X-FDA: 76817649258.27.rifle71_35b1fd26b085a X-HE-Tag: rifle71_35b1fd26b085a X-Filterd-Recvd-Size: 2869 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 15 May 2020 04:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=sEV2Dcb/vxjuVh6b2+vt3K/ZxF+r4H+loOY/Rcz7Jfs=; b=B+hdZiy3fTXn2Mq/d0DoC+/mOU O7aStKnfUbQOLviXcQAC1xrirMK/uwB39WFmDo6picuEgYmTQnVmUuZ0qd+ATNk8Ub9VtzaevKA8S AlqLvhorITqZJxUgDvRru+uRCk2j/rq3sFKAt3lJYCiM6Mtzleodx+LGlLL9FYrEh7yTFzAk/USVu oKizsjcZPJmBV6EEqOODHagdmMRMMc+pX7Q9xMcRpg9puDRmNx6DJAQ57vRz41Q6bXAawywEeqx0U ORQwc7NJ+AHpY5tIt0VCfmpRxpMRzYYA6L9uxji4uekEAN5RXxZwP2+7psdx2ejVJ1Yy/NufRZqQ/ dSkO3VcA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jZRoa-0006Is-Ic; Fri, 15 May 2020 04:19:16 +0000 Date: Thu, 14 May 2020 21:19:16 -0700 From: Matthew Wilcox To: Zhen Lei Cc: Minchan Kim , Nitin Gupta , Sergey Senozhatsky , Jens Axboe , Coly Li , Kent Overstreet , Alasdair Kergon , Mike Snitzer , linux-block , Andrew Morton , linux-mm , dm-devel , Song Liu , linux-raid , linux-kernel Subject: Re: [PATCH v2 07/10] block: use sectors_to_npage() and PAGE_SECTORS to clean up code Message-ID: <20200515041916.GE16070@bombadil.infradead.org> References: <20200507075100.1779-1-thunder.leizhen@huawei.com> <20200507075100.1779-8-thunder.leizhen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200507075100.1779-8-thunder.leizhen@huawei.com> 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: On Thu, May 07, 2020 at 03:50:57PM +0800, Zhen Lei wrote: > +++ b/block/blk-settings.c > @@ -150,7 +150,7 @@ void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_secto > unsigned int max_sectors; > > if ((max_hw_sectors << 9) < PAGE_SIZE) { > - max_hw_sectors = 1 << (PAGE_SHIFT - 9); > + max_hw_sectors = PAGE_SECTORS; Surely this should be: if (max_hw_sectors < PAGE_SECTORS) { max_hw_sectors = PAGE_SECTORS; ... no? > - page = read_mapping_page(mapping, > - (pgoff_t)(n >> (PAGE_SHIFT - 9)), NULL); > + page = read_mapping_page(mapping, (pgoff_t)sectors_to_npage(n), NULL); ... again, get the type right, and you won't need the cast.