All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: do io submit when next to write page not continues
@ 2022-08-21 17:21 Jinke Han
  0 siblings, 0 replies; only message in thread
From: Jinke Han @ 2022-08-21 17:21 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, Jinke Han

From: Jinke Han <hanjinke.666@bytedance.com>

In ext4_writepages, sometimes we leave the bio to next-to-write page for
physic block merge. But if next page no longer continus, we'd better
submit it immediately,

For extent inode, the chance of physic continue while logic block not
continus is very small. If next to write page not coninus and unmapped,
we may gather enough pages for extent and then do block allocation and
mapping for it's extent. Then we try to merge to prev bio and get failed.
For the prev bio, the waiting time is unnecessary.

In that case, we have to flush the prev bio with holding all page locks
of the extent. The submit_bio may be blocked by wbt or getting request
which may take a while. Users also may be waiting for these page locks.

In fast do_map=0 mode, we also end this not much hope waiting soon and
submit it without any page lock.

Signed-off-by: Jinke Han <hanjinke.666@bytedance.com>
---
 fs/ext4/inode.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 601214453c3a..2f7786c459c9 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2608,6 +2608,12 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)
 			if (mpd->map.m_len > 0 && mpd->next_page != page->index)
 				goto out;
 
+			/* Submit bio when page no longer continus and
+			 * do it before taking other page's lock
+			 */
+			if (mpd->next_page != page->index && mpd->io_submit.io_bio)
+				ext4_io_submit(&mpd->io_submit);
+
 			lock_page(page);
 			/*
 			 * If the page is no longer dirty, or its mapping no
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-21 17:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-21 17:21 [PATCH] ext4: do io submit when next to write page not continues Jinke Han

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.