Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2618371pxv; Sun, 11 Jul 2021 20:17:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzK+Xgx0roEndDNwhMQTzkf0WUkxFkgXnhEEjDBTeoSMwxPsmSn6vmVWX5CQtbXOyKk2cc8 X-Received: by 2002:a02:204:: with SMTP id 4mr25460736jau.66.1626059866638; Sun, 11 Jul 2021 20:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626059866; cv=none; d=google.com; s=arc-20160816; b=fPPoO22EDOJs4DwRbfoJQN4aXSKNscGtzqhjVpGFD+cA9ekLaFOMTixHGcqM7QS0qw oh1dHa9e84DFpQcNnmtRMi8jtLuW1QNMCm/NmHDHcPDhumGBLcjSoTtY0zKfkLwPCr4X k5AOAfnyO6VDQx2rgu7eHA4WXtH7fDUNH0bQRWllC2JA3PXaeOKRq/ni/BiuK77FROKu XDBuf+esKtj9crlYzKtV67HA9Zrx3mPeORzHxLXldkScqmHKMjFwyN2mbaSalifMtBdh fZ9QRkE+l5pL5tRl+vONLGS7u+v0viDuBdkGG/0fDevBV0cfESGbtnqUKnO+pxb08iW4 IuKg== 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=3E+DZTIerMFECV34tYYJ8TlvWIEchgMOxG1W7Rye3Yg=; b=r51SdWZSt/vK5UQ2Saq7JYsVZOOBiM3rM7tjpS4yU1oP70s9THQZKvDs7+2yHf22EC eLTodFVVeDe3Pzl51BUb6SL+ZzniywYpl9RWi4ZuwKoZ/MDgOboaIMXUnsTibsAmrbPH 2L/vi/4u448djv7fAdKzmjdNDlWEU94I0xL2KQEa0I2uSCcjTAtVL3o9WQqQJcytoDnH Vht8+juGPyQUC65iDmcO37mYXFk5Mkk6w+nvxi3SQs63FGWQb9arxxHEuIorU1MyBVjR e6afMFnbtAUE5DwcjNCt3ozuXS3dlFCBB4Bkg29HO2cA+wbLRmZAXxl0kxxfKTB4KOsA ev0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=AQxRZSkm; 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 c7si15205146iot.72.2021.07.11.20.17.35; Sun, 11 Jul 2021 20:17:46 -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=AQxRZSkm; 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 S232650AbhGLDTe (ORCPT + 99 others); Sun, 11 Jul 2021 23:19:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbhGLDTd (ORCPT ); Sun, 11 Jul 2021 23:19:33 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 134C1C0613DD; Sun, 11 Jul 2021 20:16:46 -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=3E+DZTIerMFECV34tYYJ8TlvWIEchgMOxG1W7Rye3Yg=; b=AQxRZSkmqlRMxJsICQZsnnzcDm /otFjEv5Du5NhztT1p7nmXYUWfH6I2LGfoxw5g5qQKJO1EWkm8msh8/XNza/DOpcYqTDngEx12EMD LI2v7XHRaZv6SAjeKx9YnBLTJV90yfljfXDOYigexVPZswbjwrUeo1klEaZMQl3lpCnifn4fk/iwI H3keduPU5mM6v9kUcEnl7nuZ36wGlBDw9z8PZpQcX1MgpTPUVsTnlYIG+3ZzFXopSwYaIBQQegaI6 /TGu8P+w6RFvljg/YAdsqlr3CQpE+n3K3W/djjwLu1eIUtPtGj8Eo+nbD98UdZzLhsc8MgXQL04+O 3MN98tpw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m2mQJ-00GnJo-NZ; Mon, 12 Jul 2021 03:16:03 +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 v13 015/137] mm/filemap: Add folio_pos() and folio_file_pos() Date: Mon, 12 Jul 2021 04:04:59 +0100 Message-Id: <20210712030701.4000097-16-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210712030701.4000097-1-willy@infradead.org> References: <20210712030701.4000097-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 aac447fbaddd..89bfc92714bf 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