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=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 CC0B6C43331 for ; Thu, 2 Apr 2020 04:04:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 90E96206E9 for ; Thu, 2 Apr 2020 04:04:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="tPPQ9H1G" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90E96206E9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 444418E0022; Thu, 2 Apr 2020 00:04:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F1F58E000D; Thu, 2 Apr 2020 00:04:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32E718E0022; Thu, 2 Apr 2020 00:04:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0089.hostedemail.com [216.40.44.89]) by kanga.kvack.org (Postfix) with ESMTP id 195508E000D for ; Thu, 2 Apr 2020 00:04:59 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id E1C85442B for ; Thu, 2 Apr 2020 04:04:58 +0000 (UTC) X-FDA: 76661574276.19.crib80_2b75a4ce72a0e X-HE-Tag: crib80_2b75a4ce72a0e X-Filterd-Recvd-Size: 3268 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Apr 2020 04:04:58 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 898B020747; Thu, 2 Apr 2020 04:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585800297; bh=xG8tm1/SuRS3+jD+8EhANF7iZdOmY29eUs0AVayP020=; h=Date:From:To:Subject:In-Reply-To:From; b=tPPQ9H1GhF7VovkiULBAbuw3nuliS0FbGuFXVqZi/eHovbqtZwwDh7B2/bRQ5EqVf 5tgqS1070zSC1+5UBeW4LS//+j6nhpHmXkPeP7mV4Fjpb0C9lxRAYgyzewDEw92Qll /+x9LXBlHrmLIfrn15g8yg5WAttNWj8QKS7+kZYA= Date: Wed, 01 Apr 2020 21:04:57 -0700 From: Andrew Morton To: akpm@linux-foundation.org, aneesh.kumar@linux.vnet.ibm.com, hch@lst.de, kirill.shutemov@linux.intel.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, pankaj.gupta.linux@gmail.com, torvalds@linux-foundation.org, willy@infradead.org Subject: [patch 034/155] include/linux/pagemap.h: rename arguments to find_subpage Message-ID: <20200402040457.RfNiVsgpt%akpm@linux-foundation.org> In-Reply-To: <20200401210155.09e3b9742e1c6e732f5a7250@linux-foundation.org> User-Agent: s-nail v14.8.16 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: From: "Matthew Wilcox (Oracle)" Subject: include/linux/pagemap.h: rename arguments to find_subpage This isn't just a random struct page, it's known to be a head page, and calling it head makes the function better self-documenting. The pgoff_t is less confusing if it's named index instead of offset. Also add a couple of comments to explain why we're doing various things. Link: http://lkml.kernel.org/r/20200318140253.6141-3-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Acked-by: Kirill A. Shutemov Acked-by: Pankaj Gupta Cc: Aneesh Kumar K.V Signed-off-by: Andrew Morton --- include/linux/pagemap.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/include/linux/pagemap.h~mm-rename-arguments-to-find_subpage +++ a/include/linux/pagemap.h @@ -333,14 +333,19 @@ static inline struct page *grab_cache_pa mapping_gfp_mask(mapping)); } -static inline struct page *find_subpage(struct page *page, pgoff_t offset) +/* + * Given the page we found in the page cache, return the page corresponding + * to this index in the file + */ +static inline struct page *find_subpage(struct page *head, pgoff_t index) { - if (PageHuge(page)) - return page; + /* HugeTLBfs wants the head page regardless */ + if (PageHuge(head)) + return head; - VM_BUG_ON_PAGE(PageTail(page), page); + VM_BUG_ON_PAGE(PageTail(head), head); - return page + (offset & (compound_nr(page) - 1)); + return head + (index & (compound_nr(head) - 1)); } struct page *find_get_entry(struct address_space *mapping, pgoff_t offset); _