From aa684fda2d244076e787997dcb42166de216344c Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Sat, 21 Sep 2024 14:07:22 +0300 Subject: [PATCH] LU-18252 llite: do not unplug the queue on each page for sync IO ll_write_end() calls into vvp_io_write_commit() at every page. this get us to: /* for sync write, kernel will wait for this page to be flushed * osc_io_end() is called, so release it earlier. * for mkwrite(), it's known there is no further pages. */ if (cl_io_is_sync_write(io) && oio->oi_active != NULL) { osc_extent_release(env, oio->oi_active); oio->oi_active = NULL; } ptlrpcd can be quick enough to intercept current (just reset) extent and start to process that while the original is still continuing. in the end this can result in suboptimal RPCs. Signed-off-by: Alex Zhuravlev Change-Id: Ie53d0cc7bb52a7ec12b39cfe3da86a623bf03f12 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56449 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Qian Yingjin Reviewed-by: Alexey Lyashkov Reviewed-by: Oleg Drokin Reviewed-by: Patrick Farrell Reviewed-by: Andreas Dilger --- lustre/llite/rw26.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 38d377f..1ce7e4e 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -1049,7 +1049,11 @@ static int ll_write_end(struct file *file, struct address_space *mapping, /* page list is not contiguous now, commit it now */ unplug = true; } - if (unplug || io->u.ci_wr.wr_sync) + /* the last call into ->write_begin() can unplug the queue */ + if (io->u.ci_wr.wr_sync && pos + len == + io->u.ci_rw.crw_pos + io->u.ci_rw.crw_bytes) + unplug = true; + if (unplug) result = vvp_io_write_commit(env, io); if (result < 0) -- 1.8.3.1