mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/3] f2fs: fix to account entry_cnt for all write bios
@ 2026-11-27 10:56 Chao Yu
  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
  0 siblings, 2 replies; 3+ messages in thread
From: Chao Yu @ 2026-11-27 10:56 UTC (permalink / raw)
  To: jaegeuk; +Cc: linux-f2fs-devel, linux-kernel, Chao Yu, stable

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-27 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-27 10:56 [PATCH v2 1/3] f2fs: fix to account entry_cnt for all write bios Chao Yu
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

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®