Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp10192pxv; Wed, 14 Jul 2021 21:43:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziNmzxcSZkc82SFMrEMZSDy0Td8DZN+9btW3epkghQLDQg4Nb7i/TNEVIZF2+appRJksFS X-Received: by 2002:a05:6e02:13e2:: with SMTP id w2mr1273414ilj.308.1626324227385; Wed, 14 Jul 2021 21:43:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626324227; cv=none; d=google.com; s=arc-20160816; b=k8p0HEaOLDLhJiOzLSSmjwLVUP/aDvd9b9+135broH9G5kxqAFmRKWHBCsA27i3RTM vXzvty7kVZFUFE2Is9KXCpqQILG0VrzmPHmlxjeDARSCMoJhTNvyyX6hHVbc0CFTQGT/ /LFv0jfR1jywl7bIE163zNqxP4siw+/PUs9jf0JItbHFEkMsbs1EB8JPuNYcUa1tekeF gm6KjH6mDNJtxrXT7mNSzqkHCtXBsiLXoPyrO4NTnmp1qTfm5W5dHVdsAM6fyoSh0MeV 734wdLDW6765/gjt19G1Twu5Ltgq7zY14QXMAwaWSTZCY9MOCl3OC13G0X2BWfJBgCGV aPJA== 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=jhieiK0e9kwbSC0V6q3aiSMkZCoboL+CZsQ228vwdU4=; b=qh32GZO10nGJni3+oXLk5WzYItqG7h2cGGnSF68e/51DnuGLkJrMos55rlk/RUvJdm xvvso4UqkSvi8NmubW6AOmCtNQRq968olc8MiR+qCziQqaX9FbgafMFZbHQWS69wvy5V SIfyBNlJ2ZZg1sCCFd5y1u1tCYkFa7JCu3+0wDqFHK4T+8FDreaddeTlPykPcvRApy9D CnZ2SQ/XknJoi7tuvh5L8fkf1TtBdgbV5+w4HD1+uDqWK1pWROvt8FTetizueuLLljCN I8OXx6k9OsDKFtGU5aX8sZmuc5Y858uTbJ+FyNW9j/5K8J6zGGlDFQrZsXmlF68Z5KNZ 2NHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="LxZuI/QR"; 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 t11si6031713jan.92.2021.07.14.21.43.35; Wed, 14 Jul 2021 21:43:47 -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="LxZuI/QR"; 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 S234380AbhGODwd (ORCPT + 99 others); Wed, 14 Jul 2021 23:52:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231684AbhGODwc (ORCPT ); Wed, 14 Jul 2021 23:52:32 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0304EC06175F; Wed, 14 Jul 2021 20:49:40 -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=jhieiK0e9kwbSC0V6q3aiSMkZCoboL+CZsQ228vwdU4=; b=LxZuI/QR9IuYa+LwfxHpkY4YcQ widkRsmj9NmBwuwF6rFJIR3GxkmlCzXeREh/EQhw0TStgk2RLKYSvl8/957+HRkrKzm6f1Uwz4DLO OQ4DiLwKuhTx3+4gq6vKHssVbm0yQRlflgZQXaH7wuJU2oqc37I9nWk6cZ+T67anJO6YFjfF1S2zY hjeykIoDsbGJMgrbRUWIsNbd3R8+2DKpoHnX9X/+d0fgTASrAbxlxj/4sOO8PgqczVGZZP6SUUZhq p8SJfmpQp8B6HAKDfrq9Rg+PAW/imeo6i8PsWWTilQC4MIj1JXNT7JWakD0+DVsofQZjhajOf4SLA PcK618FQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3sLi-002uvu-5t; Thu, 15 Jul 2021 03:48:00 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , Jeff Layton , "Kirill A . Shutemov" , Vlastimil Babka , William Kucharski , David Howells Subject: [PATCH v14 015/138] mm/filemap: Add folio_pos() and folio_file_pos() Date: Thu, 15 Jul 2021 04:35:01 +0100 Message-Id: <20210715033704.692967-16-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210715033704.692967-1-willy@infradead.org> References: <20210715033704.692967-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These are just wrappers around page_offset() and page_file_offset() respectively. No change to generated code. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Acked-by: Jeff Layton Acked-by: Kirill A. Shutemov Acked-by: Vlastimil Babka Reviewed-by: William Kucharski Reviewed-by: David Howells --- include/linux/pagemap.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index bd0e7e91bfd4..aa71fa82d6be 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -562,6 +562,27 @@ static inline loff_t page_file_offset(struct page *page) return ((loff_t)page_index(page)) << PAGE_SHIFT; } +/** + * folio_pos - Returns the byte position of this folio in its file. + * @folio: The folio. + */ +static inline loff_t folio_pos(struct folio *folio) +{ + return page_offset(&folio->page); +} + +/** + * folio_file_pos - Returns the byte position of this folio in its file. + * @folio: The folio. + * + * This differs from folio_pos() for folios which belong to a swap file. + * NFS is the only filesystem today which needs to use folio_file_pos(). + */ +static inline loff_t folio_file_pos(struct folio *folio) +{ + return page_file_offset(&folio->page); +} + extern pgoff_t linear_hugepage_index(struct vm_area_struct *vma, unsigned long address); -- 2.30.2