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=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 D8714C433ED for ; Fri, 14 May 2021 17:07:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 70B816148E for ; Fri, 14 May 2021 17:07:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 70B816148E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 93A396B006C; Fri, 14 May 2021 13:07:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8EB1C6B006E; Fri, 14 May 2021 13:07:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7DA526B0070; Fri, 14 May 2021 13:07:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0178.hostedemail.com [216.40.44.178]) by kanga.kvack.org (Postfix) with ESMTP id 4AFE36B006C for ; Fri, 14 May 2021 13:07:26 -0400 (EDT) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DF54D68A5 for ; Fri, 14 May 2021 17:07:25 +0000 (UTC) X-FDA: 78140467650.31.545B4E4 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf08.hostedemail.com (Postfix) with ESMTP id DCAA38019380 for ; Fri, 14 May 2021 17:07:23 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0DA23B061; Fri, 14 May 2021 17:07:24 +0000 (UTC) Subject: Re: [PATCH v10 13/33] mm/filemap: Add folio_next_index To: "Matthew Wilcox (Oracle)" , akpm@linux-foundation.org Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Jeff Layton References: <20210511214735.1836149-1-willy@infradead.org> <20210511214735.1836149-14-willy@infradead.org> From: Vlastimil Babka Message-ID: <92518dfb-5624-62d7-9998-305587fc561c@suse.cz> Date: Fri, 14 May 2021 19:07:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210511214735.1836149-14-willy@infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: DCAA38019380 Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf08.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspamd-Server: rspam04 X-Stat-Signature: fo4m6ynhbn6uyr34y9aaam91rpxqtet5 X-HE-Tag: 1621012043-811054 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 5/11/21 11:47 PM, Matthew Wilcox (Oracle) wrote: > This helper returns the page index of the next folio in the file (ie > the end of this folio, plus one). > > Signed-off-by: Matthew Wilcox (Oracle) > Reviewed-by: Christoph Hellwig > Acked-by: Jeff Layton Acked-by: Vlastimil Babka > --- > include/linux/pagemap.h | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h > index 8eaeffccfd38..3b82252d12fc 100644 > --- a/include/linux/pagemap.h > +++ b/include/linux/pagemap.h > @@ -406,6 +406,17 @@ static inline pgoff_t folio_index(struct folio *folio) > return folio->index; > } > > +/** > + * folio_next_index - Get the index of the next folio. > + * @folio: The current folio. > + * > + * Return: The index of the folio which follows this folio in the file. > + */ > +static inline pgoff_t folio_next_index(struct folio *folio) > +{ > + return folio->index + folio_nr_pages(folio); > +} > + > /** > * folio_file_page - The page for a particular index. > * @folio: The folio which contains this index. >