Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 70723
b: refs/heads/master
c: 6610a0b
h: refs/heads/master
i:
  70721: af1fe5c
  70719: b8bfced
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Oct 17, 2007
1 parent 86d38b0 commit 3cd741f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2b0172e1c6e6aea0a4efcfaaab38d4a02046f45a
refs/heads/master: 6610a0bc8dcc120daa1d93807d470d5cbf777c39
26 changes: 25 additions & 1 deletion trunk/fs/fs-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,30 @@ static int write_inode(struct inode *inode, int sync)
return 0;
}

/*
* Redirty an inode: set its when-it-was dirtied timestamp and move it to the
* furthest end of its superblock's dirty-inode list.
*
* Before stamping the inode's ->dirtied_when, we check to see whether it is
* already the most-recently-dirtied inode on the s_dirty list. If that is
* the case then the inode must have been redirtied while it was being written
* out and we don't reset its dirtied_when.
*/
static void redirty_tail(struct inode *inode)
{
struct super_block *sb = inode->i_sb;

if (!list_empty(&sb->s_dirty)) {
struct inode *tail_inode;

tail_inode = list_entry(sb->s_dirty.next, struct inode, i_list);
if (!time_after_eq(inode->dirtied_when,
tail_inode->dirtied_when))
inode->dirtied_when = jiffies;
}
list_move(&inode->i_list, &sb->s_dirty);
}

/*
* Write a single inode's dirty pages and inode data out to disk.
* If `wait' is set, wait on the writeout.
Expand Down Expand Up @@ -219,7 +243,7 @@ __sync_single_inode(struct inode *inode, struct writeback_control *wbc)
* Someone redirtied the inode while were writing back
* the pages.
*/
list_move(&inode->i_list, &sb->s_dirty);
redirty_tail(inode);
} else if (atomic_read(&inode->i_count)) {
/*
* The inode is clean, inuse
Expand Down

0 comments on commit 3cd741f

Please sign in to comment.