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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 B803FC433E0 for ; Sun, 14 Mar 2021 03:58:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 893F064EB2 for ; Sun, 14 Mar 2021 03:58:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234178AbhCNDrb (ORCPT ); Sat, 13 Mar 2021 22:47:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229870AbhCNDqw (ORCPT ); Sat, 13 Mar 2021 22:46:52 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B57EC061574; Sat, 13 Mar 2021 19:46:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=rsh6jCNFDW62I46pymon/qQ3m83IP2jm4c/2Qh506rs=; b=KmPxVklJYMrBB0vCYJXilTkDtV a+8sElABo0UZnLxw6I1Kz7l/E8kOCU7LX15DWTf/TOP+Xy0nC2462yTFL+/cn5W+KxWICSbDtCqEE mnSlMEhO7qS0/eE97ssacZHU7WwxXbRbs6wNxrHVrDgJEquTZx5DbPsTwWpP+rNdUzN5xCtbFi9Pe 3Qgnzis2mrRteFdCH4Pr73QajUBHMg8l4QbdeXkPaMDGFdOJuYmTeUVAXqh4odKrEJkyDvwPZe2/6 AsQbFkFzUA4sMCgqWXP3fawCLmNgwQlg3GJj6dnMMI6yXPaGM1Q6VtX0qDGogeGOaiCjP2uDQ9h0u wcqzBkDQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lLHhQ-00FVAh-Kx; Sun, 14 Mar 2021 03:46:03 +0000 Date: Sun, 14 Mar 2021 03:45:52 +0000 From: Matthew Wilcox To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v4 09/25] mm: Add folio_index, folio_page and folio_contains Message-ID: <20210314034552.GN2577561@casper.infradead.org> References: <20210305041901.2396498-1-willy@infradead.org> <20210305041901.2396498-10-willy@infradead.org> <20210313123716.a4f9403e9f6ebbd719dac2a8@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210313123716.a4f9403e9f6ebbd719dac2a8@linux-foundation.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Mar 13, 2021 at 12:37:16PM -0800, Andrew Morton wrote: > On Fri, 5 Mar 2021 04:18:45 +0000 "Matthew Wilcox (Oracle)" wrote: > > folio_index() is the equivalent of page_index() for folios. folio_page() > > finds the page in a folio for a page cache index. folio_contains() > > tells you whether a folio contains a particular page cache index. > > > > copy-paste changelog into each function's covering comment? Certainly. > > +static inline struct page *folio_page(struct folio *folio, pgoff_t index) > > +{ > > + index -= folio_index(folio); > > + VM_BUG_ON_FOLIO(index >= folio_nr_pages(folio), folio); > > + return &folio->page + index; > > +} > > One would expect folio_page() to be the reverse of page_folio(), only > it isn't anything like that. It is ... but only for files. So maybe folio_file_page()?