Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1584373pxf; Fri, 9 Apr 2021 12:04:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwu2ylCFcym9iViDjUO4MIXjVA5puxNWFW9Jr1Cft74GwUg3wTkByQBkSpo42CRdbrxkeE7 X-Received: by 2002:a17:906:81da:: with SMTP id e26mr16787188ejx.430.1617995088412; Fri, 09 Apr 2021 12:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617995088; cv=none; d=google.com; s=arc-20160816; b=Qw+PfcIFK55Kz27cibb9A59ovNRlfpu1lKi4294KW1x5Ca+CVtmqIYHSYwMATUfLOg mTZ0rcL3rkCLkjaHVij7Cx3yCcAOI4H1lxYsbQpriXr6aR5e/3fMEzBmr73qBFGLL4g0 rDjSbnAPrC9w+4AvDGZ6a48qNdNMdFGdVvTW9nTN6UPh4Nexgl5N2LEMYegw7bfLu4DL kTqZpn2LUI3dAlYBZBFqkiy0S9MVQz4D0OQCB6xd9i/bsc+hxNQ89s0UPFl6E76owkqQ 87rIhItrBpgFRU5RoVnhISRm2Z0veD8vsByCBt4OZuOSyS7sW/kyF6Y9tU0M8jmu/wnA XilA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Jy8OgE/ibRhYpmxJWqJ5F9J87NOfXTTmiZFJczWvAp4=; b=MvNue1+my65oOLvqCUSau+ZI+wDbGKEG0RQowPcYPnYF0Y4dU0dYdLohIpHz7x2pBs UqQXeo4P84xSh8lPmzl23LUf3I4uY7Q10XigM5VGnFQ/WSQDJ53OcxYnL3/uSp1pvvfb jOKBVFpkPVEPeHgGto77x+ECb/is4ChKPxIGU1W0yuS1KhVJbZLk5FTAQtf/e2q0mnK+ 0dHRduOXzumcbNzqDj5qpf8TI/4q86PGQ8bbhRshQI5fJguYRJr/wamzOdaetAVSNjng h4u34vnk5vOUInGkr2fctuPVMPDYmNfpDl2xYoENXFntp0d3c6k4Ep3wd5icGi5Qee98 ggdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=BwgYB9MB; 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 f16si2671747edy.444.2021.04.09.12.04.25; Fri, 09 Apr 2021 12:04:48 -0700 (PDT) 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=BwgYB9MB; 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 S234852AbhDITBP (ORCPT + 99 others); Fri, 9 Apr 2021 15:01:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234692AbhDITBP (ORCPT ); Fri, 9 Apr 2021 15:01:15 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 264EDC061762; Fri, 9 Apr 2021 12:01:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=Jy8OgE/ibRhYpmxJWqJ5F9J87NOfXTTmiZFJczWvAp4=; b=BwgYB9MBM7oWYpGFyfrTwgPYE7 ZSfW3lcXj4cSu2aNL0y8k4aEem7psK5ME7uwysts4LogpBrG3VvT4d4L7T1V60cRxyh31lNPbm/v7 ocqrpv4eMepzMZ1h8b37Ohpcm1QXhWvNNjkQuHX0Eo7nWlT4eC8Tn/TYfsoQbYvu1DuoMuFWohSBy mKDDEfrInd0kzeEw0XyVPy3HHITvgLDFzix0kr2+2IBFl6EYChQLztkXZJ873GEWGh2mvjlZMvzF+ 3eIDQcAHi7crkwY0u/ue4DowFsMVpaJ6g2Xoz+fNXbd76qvlYhU6sjY3eZJC3xuIH4fSHDehmay1o nC3U8MKQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lUwLn-000nlx-Ee; Fri, 09 Apr 2021 18:59:42 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com, linux-afs@lists.infradead.org, Christoph Hellwig , Jeff Layton Subject: [PATCH v7 12/28] mm/filemap: Add folio_next_index Date: Fri, 9 Apr 2021 19:50:49 +0100 Message-Id: <20210409185105.188284-13-willy@infradead.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210409185105.188284-1-willy@infradead.org> References: <20210409185105.188284-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- include/linux/pagemap.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index a8b108a9ac6e..5130503519b0 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -482,6 +482,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. -- 2.30.2