From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, Chao Yu <chao@kernel.org>,
stable@vger.kernel.org
Subject: [PATCH v2 1/3] f2fs: fix to account entry_cnt for all write bios
Date: Fri, 27 Nov 2026 10:56:41 +0000 [thread overview]
Message-ID: <20261127105640.537608-4-chao@kernel.org> (raw)
From: Chao Yu <chao@kernel.org>
Commit f32744a8b83d ("f2fs: introduce max_atc_write_bio_entry_cnt")
tracks the number of entries queued to a write bio via entry_cnt, so
that f2fs_write_end_io() can offload the completion of a write bio with
too many entries to sbi->wq if it is called in atomic context.
However, entry_cnt is only increased in f2fs_submit_page_write() and
f2fs_submit_cache_write(), it misses below write paths:
- f2fs_submit_page_bio(): single folio write bio.
- add_bio_entry(): the first folio of an IPU write bio.
- add_ipu_page(): folios merged into an IPU write bio.
So entry_cnt of these bios is less than the actual number of folios,
and a merged IPU write bio, which may contain up to BIO_MAX_VECS folios,
will never be offloaded to sbi->wq, then it may be completed in atomic
context with high latency. Let's fix to account entry_cnt in all above
paths.
Cc: stable@vger.kernel.org
Fixes: f32744a8b83d ("f2fs: introduce max_atc_write_bio_entry_cnt")
Signed-off-by: Chao Yu <chao@kernel.org>
---
v2:
- rebase to the latest dev-test branch, which supports subpage block,
no logic change.
fs/f2fs/data.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index cdc9e6e8633c..6be0cadc511e 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -959,6 +959,9 @@ int f2fs_submit_page_bio(struct f2fs_io_info *fio)
fio_lblk, fio, GFP_NOIO);
bio_add_folio_nofail(bio, data_folio, bio_len, bio_offset);
+ if (!is_read_io(fio->op))
+ F2FS_BIO(bio)->entry_cnt++;
+
if (fio->io_wbc && !is_read_io(fio->op))
wbc_account_cgroup_owner(fio->io_wbc, fio_folio, bio_len);
@@ -1030,6 +1033,7 @@ static void add_bio_entry(struct f2fs_sb_info *sbi, struct bio *bio,
bio_get(bio);
bio_add_folio_nofail(bio, folio, len, offset);
+ F2FS_BIO(bio)->entry_cnt++;
f2fs_down_write(&io->bio_list_lock);
list_add_tail(&be->list, &io->bio_list);
@@ -1077,6 +1081,7 @@ static int add_ipu_page(struct f2fs_io_info *fio, struct bio **bio,
fio_folio->mapping->host,
fio_lblk, fio) &&
bio_add_folio(*bio, folio, bio_len, bio_offset)) {
+ F2FS_BIO(*bio)->entry_cnt++;
ret = 0;
break;
}
base-commit: 9ad6c58bfbe5882b1aa0cbe2393dbfca89d2c199
prerequisite-patch-id: 23bb28339e4f35a111279d46493ac1e04fc66d58
prerequisite-patch-id: aaf2ca8ae4a7422c58daa02714ad9a5b4578bccc
prerequisite-patch-id: 207a76a8bede95d1b0ec30dc2323963da5f6ff3f
prerequisite-patch-id: baa9eb03ece0f1f0155a2226b99946327ceb3e33
prerequisite-patch-id: 1eca125a4d02fba284eaad33e37de978ec89a7d0
prerequisite-patch-id: b4566514d95142b9291270f2b64205f69c9b6edc
prerequisite-patch-id: b8f7552919f622aedea1b119674eec9cc93d8671
--
2.49.0
next reply other threads:[~2026-11-27 10:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 10:56 Chao Yu [this message]
2026-11-27 10:56 ` [PATCH v2 2/3] f2fs: introduce max_write_bio_{folio,entry}_cnt module parameters Chao Yu
2026-11-27 10:56 ` [PATCH v2 3/3] f2fs: remove max_atc_write_bio_size Chao Yu
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=20261127105640.537608-4-chao@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@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®