[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260104020729.1064529-11-chao@kernel.org>
Date: Sun, 4 Jan 2026 10:07:26 +0800
From: Chao Yu <chao@...nel.org>
To: jaegeuk@...nel.org
Cc: linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
Chao Yu <chao@...nel.org>
Subject: [PATCH 11/14] f2fs: fix timeout precision of f2fs_io_schedule_timeout_killable()
Sometimes, f2fs_io_schedule_timeout_killable(HZ) may delay for about 2
seconds, this is because __f2fs_schedule_timeout(DEFAULT_SCHEDULE_TIMEOUT)
may delay for about 2 * DEFAULT_SCHEDULE_TIMEOUT due to its precision, but
we only account the delay as DEFAULT_SCHEDULE_TIMEOUT as below, fix it.
f2fs_io_schedule_timeout_killable()
..
timeout -= DEFAULT_SCHEDULE_TIMEOUT;
Signed-off-by: Chao Yu <chao@...nel.org>
---
fs/f2fs/f2fs.h | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index c4d3b37821d6..54cde9a0e24c 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -4985,13 +4985,12 @@ static inline void __f2fs_schedule_timeout(long timeout, bool io)
static inline void f2fs_io_schedule_timeout_killable(long timeout)
{
- while (timeout) {
+ unsigned long last_time = jiffies + timeout;
+
+ while (jiffies < last_time) {
if (fatal_signal_pending(current))
return;
__f2fs_schedule_timeout(DEFAULT_SCHEDULE_TIMEOUT, true);
- if (timeout <= DEFAULT_SCHEDULE_TIMEOUT)
- return;
- timeout -= DEFAULT_SCHEDULE_TIMEOUT;
}
}
--
2.49.0
Powered by blists - more mailing lists