Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2404515pxf; Sat, 13 Mar 2021 20:15:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzj4/LnB+Rc2NNMHEczTT5xnEhYD3jhbR2/ipCtJghd0ga6Anwviuh3lEZt7B6kZBq66AZ7 X-Received: by 2002:a17:906:4955:: with SMTP id f21mr17360834ejt.74.1615695305560; Sat, 13 Mar 2021 20:15:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615695305; cv=none; d=google.com; s=arc-20160816; b=Qdk9XLLofdIW4foW7M9uwcTxXnqK8/+qglPn7y2Qo47+XDgvHDliJdxTDTayo5lYyQ b7Ys1novB3X+im0Lg6knUqKHuXpsgOQf8JmhPS2xpGuKExbfOrD/t6NJzm8Fl+eKx/FW 8Z2Z4lOtOGccwGm6/3Wv1wVr6aGanWSinVXSFJPxPyCs3XPqzVO0Qn+3hoSmV4IgppZ2 P0Gnmwn1gpkuh4lxuK/uVVbPrc0+YdGa8/CJ1ccw5+QvwwIN/UB8OkXrhYsaKE9TNm2J 9mbCvIGaXCdSeRB1jOFS0rkFFxe6CufHjOhGFi3dTMF0ykE8sULCVaEXk7cPwGBdf3e/ CeDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rsh6jCNFDW62I46pymon/qQ3m83IP2jm4c/2Qh506rs=; b=mXqoqUM0kNsLGaPZVOKxphiskD6k4rYpaBeUzOcY4Icbd7xMA1JCE2WEyHVIFEIwao 41V5mKdx096Hb5lz19HqMY+iSzRt0aSnKz/aeWu+Geqkb4OWMyXVd+LtF0XjQMErUfNW rpJc5GX6VfDMAU7mRNk2GC8VDtCFaKKj2dzyNUxw5m3cxYjiLdFrqF0Cmddv95vB+l/m u/GGtA8w1ooJH9Gn34OmXe/9XyR8W1EMbn/0zhI8pkAaXD/Huqy+VhyOMRX0ZHfbB49+ B8Mxv1J1uxclb5wHaTt6NfPHq8zU/fS/3kudXV740maY/SP6kXhxViS5EGjzRekWOuOp 8LcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=KmPxVklJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y14si8218696ejw.723.2021.03.13.20.14.12; Sat, 13 Mar 2021 20:15:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=KmPxVklJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233797AbhCNDra (ORCPT + 99 others); Sat, 13 Mar 2021 22:47:30 -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()?