mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
writeback: reset dirtied_when when switching wbs
When switching a dirty inode to another wb, inode_do_switch_wbs() puts
it at the newest end of the target b_dirty list instead of searching
for its sorted position. This requires updating dirtied_when, which
move_expired_inodes() uses to decide where to stop scanning.
However, the switch updates dirtied_time_when instead. This leaves
b_dirty out of order and can make the scan stop before reaching older
inodes. It also resets the lazytime expiration timestamp, potentially
delaying timestamp writeback.
Update dirtied_when instead, preserving both the constant-time insertion
and the lazytime expiration timestamp. Correct the field name in the
comment and document the distinction between the two inode timestamps.
Fixes: 9a6ebbdbd4 ("writeback: Avoid excessively long inode switching times")
Cc: stable@vger.kernel.org
Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
Link: https://patch.msgid.link/20261016115230.3640770-2-sunjunchao@bytedance.com
Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
parent
7459c02187
commit
13b9a606dd
|
|
@ -468,12 +468,12 @@ static bool inode_do_switch_wbs(struct inode *inode,
|
|||
if (inode_state_read(inode) & I_DIRTY_ALL) {
|
||||
/*
|
||||
* We need to keep b_dirty list sorted by
|
||||
* dirtied_time_when. However properly sorting the
|
||||
* dirtied_when. However properly sorting the
|
||||
* inode in the list gets too expensive when switching
|
||||
* many inodes. So just attach inode at the end of the
|
||||
* dirty list and clobber the dirtied_time_when.
|
||||
* dirty list and clobber the dirtied_when.
|
||||
*/
|
||||
inode->dirtied_time_when = jiffies;
|
||||
inode->dirtied_when = jiffies;
|
||||
inode_io_list_move_locked(inode, new_wb,
|
||||
&new_wb->b_dirty);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -815,7 +815,9 @@ struct inode {
|
|||
/* 32-bit hole */
|
||||
struct rw_semaphore i_rwsem;
|
||||
|
||||
unsigned long dirtied_when; /* jiffies of first dirtying */
|
||||
/* Timestamp for writeback list ordering and age checks (jiffies). */
|
||||
unsigned long dirtied_when;
|
||||
/* Start time for deciding when lazytime updates need writeback (jiffies). */
|
||||
unsigned long dirtied_time_when;
|
||||
|
||||
struct hlist_node i_hash;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user