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=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 DD971C10DCE for ; Wed, 18 Mar 2020 14:03:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9EDE520768 for ; Wed, 18 Mar 2020 14:03:10 +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="cgyPLYG+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EDE520768 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 E0A4F6B006E; Wed, 18 Mar 2020 10:02:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C3A6E6B0073; Wed, 18 Mar 2020 10:02:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8479B6B0036; Wed, 18 Mar 2020 10:02:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id 5B3446B0072 for ; Wed, 18 Mar 2020 10:02:57 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 28E7B180AD81F for ; Wed, 18 Mar 2020 14:02:57 +0000 (UTC) X-FDA: 76608649194.22.debt89_19b40e0004d5e X-HE-Tag: debt89_19b40e0004d5e X-Filterd-Recvd-Size: 3025 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Wed, 18 Mar 2020 14:02:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=uyO7SgPaDFDYdErpoVDA7Ol+uGAjS8d6V7qnvFIhgg0=; b=cgyPLYG+zOw1F9+LNfEMOYf2Ug OVnp+ru+sPdu3kT+vBM7IiNON95sX6+wUQiWxbylgycc95Zb4NyVz2YGaMVofj2OMT0noYeyv5OpW 4ShEWklMukRNYAB/xTSvi6pmH0y2VFuK00byW3G4mSXfaSnu0Ux4EArsFeOMW/Z4qemCNo3TJ5JBd PXw0vT1ibQqy5VYCE/pDNtLFMCqFsabE/dhlpJbn1uHa5CHdZTgDBEbJasJbLK9+5slJ+M3SpU4w1 3ZPBO+1lw778TlEIDLwI8Abb3JjG3cZcYoaC23WLTNXwtJlXUl2+G/GH404ojGZ82IedinXIZP5BN 45cOnRDg==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jEZHb-0001c1-CI; Wed, 18 Mar 2020 14:02:55 +0000 From: Matthew Wilcox To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH v2 2/8] mm: Rename arguments to find_subpage Date: Wed, 18 Mar 2020 07:02:47 -0700 Message-Id: <20200318140253.6141-3-willy@infradead.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200318140253.6141-1-willy@infradead.org> References: <20200318140253.6141-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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)" 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. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index b4ea3a5d00e5..68db0ed8535d 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -333,14 +333,19 @@ static inline struct page *grab_cache_page_nowait(s= truct address_space *mapping, mapping_gfp_mask(mapping)); } =20 -static inline struct page *find_subpage(struct page *page, pgoff_t offse= t) +/* + * Given the page we found in the page cache, return the page correspond= ing + * 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; =20 - VM_BUG_ON_PAGE(PageTail(page), page); + VM_BUG_ON_PAGE(PageTail(head), head); =20 - return page + (offset & (compound_nr(page) - 1)); + return head + (index & (compound_nr(head) - 1)); } =20 struct page *find_get_entry(struct address_space *mapping, pgoff_t offse= t); --=20 2.25.1