Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Chao Yu and committed by
Jaegeuk Kim
6fa11605 da90b671

+3 -4
+3 -4
fs/f2fs/f2fs.h
··· 4985 4985 4986 4986 static inline void f2fs_io_schedule_timeout_killable(long timeout) 4987 4987 { 4988 - while (timeout) { 4988 + unsigned long last_time = jiffies + timeout; 4989 + 4990 + while (jiffies < last_time) { 4989 4991 if (fatal_signal_pending(current)) 4990 4992 return; 4991 4993 __f2fs_schedule_timeout(DEFAULT_SCHEDULE_TIMEOUT, true); 4992 - if (timeout <= DEFAULT_SCHEDULE_TIMEOUT) 4993 - return; 4994 - timeout -= DEFAULT_SCHEDULE_TIMEOUT; 4995 4994 } 4996 4995 } 4997 4996