|
@@ -165,25 +165,11 @@ static void redirty_tail(struct inode *inode)
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- * Redirty an inode, but mark it as the very next-to-be-written inode on its
|
|
|
|
- * superblock's dirty-inode list.
|
|
|
|
- * We need to preserve s_dirty's reverse-time-orderedness, so we cheat by
|
|
|
|
- * setting this inode's dirtied_when to the same value as that of the inode
|
|
|
|
- * which is presently head-of-list, if present head-of-list is newer than this
|
|
|
|
- * inode. (head-of-list is the least-recently-dirtied inode: the oldest one).
|
|
|
|
|
|
+ * requeue inode for re-scanning after sb->s_io list is exhausted.
|
|
*/
|
|
*/
|
|
-static void redirty_head(struct inode *inode)
|
|
|
|
|
|
+static void requeue_io(struct inode *inode)
|
|
{
|
|
{
|
|
- struct super_block *sb = inode->i_sb;
|
|
|
|
-
|
|
|
|
- if (!list_empty(&sb->s_dirty)) {
|
|
|
|
- struct inode *head_inode;
|
|
|
|
-
|
|
|
|
- head_inode = list_entry(sb->s_dirty.prev, struct inode, i_list);
|
|
|
|
- if (time_after(inode->dirtied_when, head_inode->dirtied_when))
|
|
|
|
- inode->dirtied_when = head_inode->dirtied_when;
|
|
|
|
- }
|
|
|
|
- list_move_tail(&inode->i_list, &sb->s_dirty);
|
|
|
|
|
|
+ list_move(&inode->i_list, &inode->i_sb->s_more_io);
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -255,7 +241,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
|
|
* uncongested.
|
|
* uncongested.
|
|
*/
|
|
*/
|
|
inode->i_state |= I_DIRTY_PAGES;
|
|
inode->i_state |= I_DIRTY_PAGES;
|
|
- redirty_head(inode);
|
|
|
|
|
|
+ requeue_io(inode);
|
|
} else {
|
|
} else {
|
|
/*
|
|
/*
|
|
* Otherwise fully redirty the inode so that
|
|
* Otherwise fully redirty the inode so that
|
|
@@ -315,7 +301,7 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc)
|
|
* on s_io. We'll have another go at writing back this inode
|
|
* on s_io. We'll have another go at writing back this inode
|
|
* when the s_dirty iodes get moved back onto s_io.
|
|
* when the s_dirty iodes get moved back onto s_io.
|
|
*/
|
|
*/
|
|
- redirty_head(inode);
|
|
|
|
|
|
+ requeue_io(inode);
|
|
|
|
|
|
/*
|
|
/*
|
|
* Even if we don't actually write the inode itself here,
|
|
* Even if we don't actually write the inode itself here,
|
|
@@ -410,14 +396,14 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
|
|
wbc->encountered_congestion = 1;
|
|
wbc->encountered_congestion = 1;
|
|
if (!sb_is_blkdev_sb(sb))
|
|
if (!sb_is_blkdev_sb(sb))
|
|
break; /* Skip a congested fs */
|
|
break; /* Skip a congested fs */
|
|
- redirty_head(inode);
|
|
|
|
|
|
+ requeue_io(inode);
|
|
continue; /* Skip a congested blockdev */
|
|
continue; /* Skip a congested blockdev */
|
|
}
|
|
}
|
|
|
|
|
|
if (wbc->bdi && bdi != wbc->bdi) {
|
|
if (wbc->bdi && bdi != wbc->bdi) {
|
|
if (!sb_is_blkdev_sb(sb))
|
|
if (!sb_is_blkdev_sb(sb))
|
|
break; /* fs has the wrong queue */
|
|
break; /* fs has the wrong queue */
|
|
- redirty_head(inode);
|
|
|
|
|
|
+ requeue_io(inode);
|
|
continue; /* blockdev has wrong queue */
|
|
continue; /* blockdev has wrong queue */
|
|
}
|
|
}
|
|
|
|
|
|
@@ -427,8 +413,10 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
|
|
|
|
|
|
/* Was this inode dirtied too recently? */
|
|
/* Was this inode dirtied too recently? */
|
|
if (wbc->older_than_this && time_after(inode->dirtied_when,
|
|
if (wbc->older_than_this && time_after(inode->dirtied_when,
|
|
- *wbc->older_than_this))
|
|
|
|
|
|
+ *wbc->older_than_this)) {
|
|
|
|
+ list_splice_init(&sb->s_io, sb->s_dirty.prev);
|
|
break;
|
|
break;
|
|
|
|
+ }
|
|
|
|
|
|
/* Is another pdflush already flushing this queue? */
|
|
/* Is another pdflush already flushing this queue? */
|
|
if (current_is_pdflush() && !writeback_acquire(bdi))
|
|
if (current_is_pdflush() && !writeback_acquire(bdi))
|
|
@@ -458,6 +446,10 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc)
|
|
if (wbc->nr_to_write <= 0)
|
|
if (wbc->nr_to_write <= 0)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (list_empty(&sb->s_io))
|
|
|
|
+ list_splice_init(&sb->s_more_io, &sb->s_io);
|
|
|
|
+
|
|
return; /* Leave any unwritten inodes on s_io */
|
|
return; /* Leave any unwritten inodes on s_io */
|
|
}
|
|
}
|
|
|
|
|