Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3913558pxj; Tue, 11 May 2021 15:00:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0M9fdZJlevAcM8xtEZfFa1hgrpppOETb3U8I0pb2H5zWe0ATV+vEmLddVPOCERChN2N8V X-Received: by 2002:aa7:dc17:: with SMTP id b23mr38967723edu.359.1620770442002; Tue, 11 May 2021 15:00:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620770441; cv=none; d=google.com; s=arc-20160816; b=G6C2nZBGSej/cjAPWttx0tsmTWeDYt1oGJWYi6RgSEQlE85Z0Gc9rigGMBwwgrzO5v 0B4DkZipA6o3ikb3YZNEPjqQm6gzW4XJwEId8dPipbskQHNi8O7jDFEZ3mLymfUhT7Dn zD0pROnrPWok0KzDlbvPqYxKl2ed2Q6qwlQmYC4T1q4MU6wMj0dt96Qb8IgsA0mDndPE swGZZivJqaQgp/ZbDK/tE5VwwLtBuE/3GP4PIbym2Mlo2yCLOwPncEO18k3l2xfGWCmh 9G0D4VoXFRInACx6T9/7+657in8V/HxAlgwr+x+mDWKUohAUmoNOTT0QFHgpq98qYriP jOrA== 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=slr8t+6ZwKifGMrvwqS4rOmeg/A72JJfbwrzhXlZeNg=; b=SanLngQYizTP6PiKZuvt3p8rQDGNiHaLuaegUlbiTInuIhn8vsPzf1xpLgFutzclsa JfWTwsFecD89uARdy1vH9Vu9iavZrNQzdB+maX9R2uuVR7/GAyDRQ8ZtqdOfB+lBbrEC KtoJ0h9izrAYM8JVRx+1xJ6vS0c9j/efNTy1a8caJ0COYc314GKp8Y62YA+0EdF7gS3B mTn5N0mvdBSrqzdyK/CQjwoJI88aW/mAlW5TWusIYllZc07fhYoPUNoSvwiuj/BkGkg+ JjWGecHCsZUI0trVKc+zfIHs/gjJ9Nb5wg7vBCPN9ZZrIIGSheCJ8Q4ZQJTjrJew5ezK sWcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=vSLRx2LI; 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 d5si16879659edq.561.2021.05.11.15.00.15; Tue, 11 May 2021 15:00:41 -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=vSLRx2LI; 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 S229996AbhEKV62 (ORCPT + 99 others); Tue, 11 May 2021 17:58:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbhEKV6Z (ORCPT ); Tue, 11 May 2021 17:58:25 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64F6BC061574; Tue, 11 May 2021 14:57:18 -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=slr8t+6ZwKifGMrvwqS4rOmeg/A72JJfbwrzhXlZeNg=; b=vSLRx2LIN7aej0REbuNYoUBkW0 BvJF87Bv1hch0ix4sTvN+dwW9Bv98SKNoHeaqhNyyBvBiPjqWsmd2V4jCeuCz/ft+7nrJu5uPjLsh rIVf+qy+FLtZDHobhLS/Dh65x2/+beMrbiliuqCTsthee536dQUG4rV/QzMveL1ch8Qdjpt+XjP0N Dhi+DiKQDxwHTw0nNrv2ob1eXKPlwesFKUP0ZRqbtXmzD1Pssi7HTzlKfa/Dfdng2bfxmq8idcwqd 0SCl+WgIP0agieW2VeD88SVBAF3VDubW2jV15+rmqcb46gSPTZSh9jDXDQr5aYjXVcRc1nOywJaCS U6JyDjBQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lgaMC-007i92-4W; Tue, 11 May 2021 21:56:08 +0000 From: "Matthew Wilcox (Oracle)" To: akpm@linux-foundation.org Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Hellwig , Jeff Layton Subject: [PATCH v10 13/33] mm/filemap: Add folio_next_index Date: Tue, 11 May 2021 22:47:15 +0100 Message-Id: <20210511214735.1836149-14-willy@infradead.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210511214735.1836149-1-willy@infradead.org> References: <20210511214735.1836149-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 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. -- 2.30.2