diff options
| author | Kemeng Shi <[email protected]> | 2024-02-28 09:19:56 +0000 |
|---|---|---|
| committer | Christian Brauner <[email protected]> | 2024-04-05 13:53:45 +0000 |
| commit | 639924abc1ae28eb05893a402081e8e6cff23b8a (patch) | |
| tree | b49adda2eedd0e50a3b64fefab9eafa00223d4bd /fs/fs-writeback.c | |
| parent | fs/writeback: remove unused parameter wb of finish_writeback_work (diff) | |
| download | kernel-639924abc1ae28eb05893a402081e8e6cff23b8a.tar.gz kernel-639924abc1ae28eb05893a402081e8e6cff23b8a.zip | |
fs/writeback: only calculate dirtied_before when b_io is empty
The dirtied_before is only used when b_io is not empty, so only calculate
when b_io is not empty.
Signed-off-by: Kemeng Shi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Jan Kara <[email protected]>
Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'fs/fs-writeback.c')
| -rw-r--r-- | fs/fs-writeback.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index a754eb254535..cbfb3e05e120 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2105,20 +2105,21 @@ static long wb_writeback(struct bdi_writeback *wb, spin_lock(&wb->list_lock); - /* - * Kupdate and background works are special and we want to - * include all inodes that need writing. Livelock avoidance is - * handled by these works yielding to any other work so we are - * safe. - */ - if (work->for_kupdate) { - dirtied_before = jiffies - - msecs_to_jiffies(dirty_expire_interval * 10); - } else if (work->for_background) - dirtied_before = jiffies; - trace_writeback_start(wb, work); if (list_empty(&wb->b_io)) { + /* + * Kupdate and background works are special and we want + * to include all inodes that need writing. Livelock + * avoidance is handled by these works yielding to any + * other work so we are safe. + */ + if (work->for_kupdate) { + dirtied_before = jiffies - + msecs_to_jiffies(dirty_expire_interval * + 10); + } else if (work->for_background) + dirtied_before = jiffies; + queue_io(wb, work, dirtied_before); queued = true; } |
