From patchwork Thu Aug 22 01:37:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 13772431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 327B5C52D7C for ; Thu, 22 Aug 2024 01:29:57 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sgweC-0003Ys-Ql; Thu, 22 Aug 2024 01:29:56 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sgweB-0003YV-MH for linux-f2fs-devel@lists.sourceforge.net; Thu, 22 Aug 2024 01:29:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=J63If87hVIuHjNt9QKFABY3dpsWo54CKym+jHnW8ez0=; b=JtuY9Ni3p9PE6ZVzCAPftFVmNr ZLs8NTV8FFfufJgSUcMbP6vxq7QGhVju1MtO9NsbPECwB7kV8KriRjObA7GrMptXCJm0k99yDxmJd VglIRCD+RH6lenMlD7sBe5L5rea5q9lq8ek3Nup/JCCSfbPL1m4mIcYXhdqZx0u3xAes=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=J63If87hVIuHjNt9QKFABY3dpsWo54CKym+jHnW8ez0=; b=kuGCudoA47K4/efNJPcoCB+s50 AyQwdPj0jdr0yq3PFnEMuLXpez8ZPOza4qn2/I8BqWuzIsOcfMlymHS7YXlxTpcID8r6Y2qlFK1Kj DN/I4nb/QCBFkTI1LEi+z/U1RtiIhqHbXxW1FGuXttmafqF7TnZrmoIsEmQk8nHSPWLE=; Received: from szxga07-in.huawei.com ([45.249.212.35]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sgweA-0006c8-NW for linux-f2fs-devel@lists.sourceforge.net; Thu, 22 Aug 2024 01:29:55 +0000 Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Wq5GV6PHbz1S8V0; Thu, 22 Aug 2024 09:29:38 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id 8DFC11400FD; Thu, 22 Aug 2024 09:29:42 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 09:29:42 +0800 To: , , , Date: Thu, 22 Aug 2024 09:37:09 +0800 Message-ID: <20240822013714.3278193-10-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822013714.3278193-1-lizetao1@huawei.com> References: <20240822013714.3278193-1-lizetao1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemd500012.china.huawei.com (7.221.188.25) X-Headers-End: 1sgweA-0006c8-NW Subject: [f2fs-dev] [PATCH 09/14] btrfs: convert try_release_extent_mapping() to take a folio X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Li Zetao via Linux-f2fs-devel From: Li Zetao Reply-To: Li Zetao Cc: linux-btrfs@vger.kernel.org, willy@infradead.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net The old page API is being gradually replaced and converted to use folio to improve code readability and avoid repeated conversion between page and folio. And page_to_inode() can be replaced with folio_to_inode() now. Signed-off-by: Li Zetao --- fs/btrfs/extent_io.c | 6 +++--- fs/btrfs/extent_io.h | 2 +- fs/btrfs/inode.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 27ca7a56d8f5..cfd523b523b3 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2435,11 +2435,11 @@ static bool try_release_extent_state(struct extent_io_tree *tree, * in the range corresponding to the page, both state records and extent * map records are removed */ -bool try_release_extent_mapping(struct page *page, gfp_t mask) +bool try_release_extent_mapping(struct folio *folio, gfp_t mask) { - u64 start = page_offset(page); + u64 start = folio_pos(folio); u64 end = start + PAGE_SIZE - 1; - struct btrfs_inode *inode = page_to_inode(page); + struct btrfs_inode *inode = folio_to_inode(folio); struct extent_io_tree *io_tree = &inode->io_tree; while (start <= end) { diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index f4c93ca46bdd..d1c54788d444 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h @@ -236,7 +236,7 @@ static inline void extent_changeset_free(struct extent_changeset *changeset) kfree(changeset); } -bool try_release_extent_mapping(struct page *page, gfp_t mask); +bool try_release_extent_mapping(struct folio *folio, gfp_t mask); int try_release_extent_buffer(struct folio *folio); int btrfs_read_folio(struct file *file, struct folio *folio); diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5e3b834cc72b..e844c409c12a 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -7238,7 +7238,7 @@ static int btrfs_launder_folio(struct folio *folio) static bool __btrfs_release_folio(struct folio *folio, gfp_t gfp_flags) { - if (try_release_extent_mapping(&folio->page, gfp_flags)) { + if (try_release_extent_mapping(folio, gfp_flags)) { wait_subpage_spinlock(folio); clear_page_extent_mapped(folio); return true;