From patchwork Tue Feb 18 05:51:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13979109 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 1BA43C021B4 for ; Tue, 18 Feb 2025 05:52:29 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1tkGWy-0006az-OM; Tue, 18 Feb 2025 05:52:28 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1tkGWo-0006ZT-7g for linux-f2fs-devel@lists.sourceforge.net; Tue, 18 Feb 2025 05:52:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; 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: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=YLhaJqMFtJssujjlGsqYJzBlDzSSPVjntuvommLyzm4=; b=i3CBcXqgJbwjroAPntjj3//Tm/ wn1/e80+2tELUtPXvcr5u6dz/ivpAGOcYAO3gKZWhp0so6V/ql6jPqBmbA2iUNRPhpPN1FvkaG0jA zJvKPd3BBuapaZIFM0twNAG71pPru4XldrDC0tiynyJoL/tiIIIfUFV5Pr0eQGW3QxpU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; 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: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=YLhaJqMFtJssujjlGsqYJzBlDzSSPVjntuvommLyzm4=; b=Jy9nGd3LcBYruVtyIh6GNElWQs tTx8FGClrHwUoMWjvMONsSc2cGhEBbchMoeiel/Io0pBg3d5K7xCWJULwF1p5v+uTFtZiMQzJMfea uHYQGPj84MRnHDmDlz8UfBye4RrPkCrRGsjhhYl0fKGODhvjWClrkol/nGx5mISLljpo=; Received: from casper.infradead.org ([90.155.50.34]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1tkGWn-0007c7-LQ for linux-f2fs-devel@lists.sourceforge.net; Tue, 18 Feb 2025 05:52:18 +0000 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=YLhaJqMFtJssujjlGsqYJzBlDzSSPVjntuvommLyzm4=; b=Ro41HNEt4KXKyLQfksiukOOls+ Y7p6AepqIaMsBeQ4/cbftPxr8QURdlytyph0GxW/JRpNBmQbVTFSV479ldDi3HhwIWHn7n1FywvO5 Qb14o3Qr9Py6kHNlTxkFFkBRzdnoHBAQk01bOdTRVfL82zwrZ6Ysov0QD5OBfApSoY4SOMpOg7Vkv X7aUPqkYE5BIKoPk7AJ0w300O0wDhTQD1GcTbOAOUA/luEUDW6S8RHckBzpEvJuoZqEcFgsENwmOK fI7E6AD+V2F0IeBhgFhJHuYRVleS9Y58QjAeZUPfpB8igSTVbTeHjn+G96At86F/NFF44xp+lVkn+ dkkcb4Ew==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tkGWc-00000002Trk-1SGJ; Tue, 18 Feb 2025 05:52:06 +0000 From: "Matthew Wilcox (Oracle)" To: Jaegeuk Kim , Chao Yu Date: Tue, 18 Feb 2025 05:51:42 +0000 Message-ID: <20250218055203.591403-9-willy@infradead.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250218055203.591403-1-willy@infradead.org> References: <20250218055203.591403-1-willy@infradead.org> MIME-Version: 1.0 X-Headers-End: 1tkGWn-0007c7-LQ Subject: [f2fs-dev] [PATCH 08/27] f2fs: Convert last_fsync_dnode() to use 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: , Cc: linux-fsdevel@vger.kernel.org, "Matthew Wilcox \(Oracle\)" , linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Use the folio APIs where they exist. Saves several hidden calls to compound_head(). Also removes a reference to page->mapping. Signed-off-by: Matthew Wilcox (Oracle) --- fs/f2fs/node.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 415bda9acd0e..66260fae3cc8 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1565,7 +1565,7 @@ static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino) { pgoff_t index; struct folio_batch fbatch; - struct page *last_page = NULL; + struct folio *last_folio = NULL; int nr_folios; folio_batch_init(&fbatch); @@ -1577,45 +1577,45 @@ static struct page *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino) int i; for (i = 0; i < nr_folios; i++) { - struct page *page = &fbatch.folios[i]->page; + struct folio *folio = fbatch.folios[i]; if (unlikely(f2fs_cp_error(sbi))) { - f2fs_put_page(last_page, 0); + f2fs_folio_put(last_folio, false); folio_batch_release(&fbatch); return ERR_PTR(-EIO); } - if (!IS_DNODE(page) || !is_cold_node(page)) + if (!IS_DNODE(&folio->page) || !is_cold_node(&folio->page)) continue; - if (ino_of_node(page) != ino) + if (ino_of_node(&folio->page) != ino) continue; - lock_page(page); + folio_lock(folio); - if (unlikely(page->mapping != NODE_MAPPING(sbi))) { + if (unlikely(folio->mapping != NODE_MAPPING(sbi))) { continue_unlock: - unlock_page(page); + folio_unlock(folio); continue; } - if (ino_of_node(page) != ino) + if (ino_of_node(&folio->page) != ino) goto continue_unlock; - if (!PageDirty(page)) { + if (!folio_test_dirty(folio)) { /* someone wrote it for us */ goto continue_unlock; } - if (last_page) - f2fs_put_page(last_page, 0); + if (last_folio) + f2fs_folio_put(last_folio, false); - get_page(page); - last_page = page; - unlock_page(page); + folio_get(folio); + last_folio = folio; + folio_unlock(folio); } folio_batch_release(&fbatch); cond_resched(); } - return last_page; + return &last_folio->page; } static int __write_node_page(struct page *page, bool atomic, bool *submitted,