From: Christoph Hellwig <hch@lst.de>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <chao@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] f2fs: return bool from __write_node_folio
Date: Thu, 8 May 2025 07:14:32 +0200 [thread overview]
Message-ID: <20250508051520.4169795-7-hch@lst.de> (raw)
In-Reply-To: <20250508051520.4169795-1-hch@lst.de>
__write_node_folio can only return 0 or AOP_WRITEPAGE_ACTIVATE.
As part of phasing out AOP_WRITEPAGE_ACTIVATE, switch to a bool return
instead.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chao Yu <chao@kernel.org>
---
fs/f2fs/node.c | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index cbc7e9997b74..3f6b8037d25f 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1651,7 +1651,7 @@ static struct folio *last_fsync_dnode(struct f2fs_sb_info *sbi, nid_t ino)
return last_folio;
}
-static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
+static bool __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
struct writeback_control *wbc, bool do_balance,
enum iostat_type io_type, unsigned int *seq_id)
{
@@ -1681,7 +1681,7 @@ static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
folio_clear_uptodate(folio);
dec_page_count(sbi, F2FS_DIRTY_NODES);
folio_unlock(folio);
- return 0;
+ return true;
}
if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING)))
@@ -1707,7 +1707,7 @@ static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
dec_page_count(sbi, F2FS_DIRTY_NODES);
f2fs_up_read(&sbi->node_write);
folio_unlock(folio);
- return 0;
+ return true;
}
if (__is_valid_data_blkaddr(ni.blk_addr) &&
@@ -1746,11 +1746,12 @@ static int __write_node_folio(struct folio *folio, bool atomic, bool *submitted,
if (do_balance)
f2fs_balance_fs(sbi, false);
- return 0;
+ return true;
redirty_out:
folio_redirty_for_writepage(wbc, folio);
- return AOP_WRITEPAGE_ACTIVATE;
+ folio_unlock(folio);
+ return false;
}
int f2fs_move_node_folio(struct folio *node_folio, int gc_type)
@@ -1772,11 +1773,9 @@ int f2fs_move_node_folio(struct folio *node_folio, int gc_type)
goto out_page;
}
- if (__write_node_folio(node_folio, false, NULL,
- &wbc, false, FS_GC_NODE_IO, NULL)) {
+ if (!__write_node_folio(node_folio, false, NULL,
+ &wbc, false, FS_GC_NODE_IO, NULL))
err = -EAGAIN;
- folio_unlock(node_folio);
- }
goto release_page;
} else {
/* set page dirty and write it */
@@ -1871,11 +1870,10 @@ int f2fs_fsync_node_pages(struct f2fs_sb_info *sbi, struct inode *inode,
if (!folio_clear_dirty_for_io(folio))
goto continue_unlock;
- if (__write_node_folio(folio, atomic &&
+ if (!__write_node_folio(folio, atomic &&
folio == last_folio,
&submitted, wbc, true,
FS_NODE_IO, seq_id)) {
- folio_unlock(folio);
f2fs_folio_put(last_folio, false);
folio_batch_release(&fbatch);
ret = -EIO;
@@ -2078,16 +2076,15 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
set_fsync_mark(&folio->page, 0);
set_dentry_mark(&folio->page, 0);
- ret = __write_node_folio(folio, false, &submitted,
- wbc, do_balance, io_type, NULL);
- if (ret) {
+ if (!__write_node_folio(folio, false, &submitted,
+ wbc, do_balance, io_type, NULL)) {
folio_unlock(folio);
folio_batch_release(&fbatch);
ret = -EIO;
goto out;
- } else if (submitted) {
- nwritten++;
}
+ if (submitted)
+ nwritten++;
if (--wbc->nr_to_write == 0)
break;
--
2.47.2
prev parent reply other threads:[~2025-05-08 5:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 5:14 cleanup AOP_WRITEPAGE_ACTIVATE use in f2fs v2 Christoph Hellwig
2025-05-08 5:14 ` [PATCH 1/6] f2fs: fix to return correct error number in f2fs_sync_node_pages() Christoph Hellwig
2025-05-08 16:30 ` [f2fs-dev] " patchwork-bot+f2fs
2025-05-08 5:14 ` [PATCH 2/6] f2fs: return bool from __f2fs_write_meta_folio Christoph Hellwig
2025-05-08 5:14 ` [PATCH 3/6] f2fs: remove wbc->for_reclaim handling Christoph Hellwig
2025-05-08 9:46 ` Chao Yu
2025-05-08 5:14 ` [PATCH 4/6] f2fs: always unlock the page in f2fs_write_single_data_page Christoph Hellwig
2025-05-08 9:48 ` Chao Yu
2025-05-08 5:14 ` [PATCH 5/6] f2fs: simplify return value handling in f2fs_fsync_node_pages Christoph Hellwig
2025-05-08 9:53 ` Chao Yu
2025-05-08 5:14 ` Christoph Hellwig [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250508051520.4169795-7-hch@lst.de \
--to=hch@lst.de \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®