Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 336040
b: refs/heads/master
c: 4eff96d
h: refs/heads/master
v: v3
  • Loading branch information
Jan Kara authored and Linus Torvalds committed Nov 27, 2012
1 parent ac2d395 commit ca2dbcd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 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: 50694c28f1e1dbea18272980d265742a5027fb63
refs/heads/master: 4eff96dd5283a102e0c1cac95247090be74a38ed
2 changes: 2 additions & 0 deletions trunk/fs/fs-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ static void requeue_io(struct inode *inode, struct bdi_writeback *wb)
static void inode_sync_complete(struct inode *inode)
{
inode->i_state &= ~I_SYNC;
/* If inode is clean an unused, put it into LRU now... */
inode_add_lru(inode);
/* Waiters must see I_SYNC cleared before being woken up */
smp_mb();
wake_up_bit(&inode->i_state, __I_SYNC);
Expand Down
16 changes: 14 additions & 2 deletions trunk/fs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,19 @@ static void inode_lru_list_add(struct inode *inode)
spin_unlock(&inode->i_sb->s_inode_lru_lock);
}

/*
* Add inode to LRU if needed (inode is unused and clean).
*
* Needs inode->i_lock held.
*/
void inode_add_lru(struct inode *inode)
{
if (!(inode->i_state & (I_DIRTY | I_SYNC | I_FREEING | I_WILL_FREE)) &&
!atomic_read(&inode->i_count) && inode->i_sb->s_flags & MS_ACTIVE)
inode_lru_list_add(inode);
}


static void inode_lru_list_del(struct inode *inode)
{
spin_lock(&inode->i_sb->s_inode_lru_lock);
Expand Down Expand Up @@ -1390,8 +1403,7 @@ static void iput_final(struct inode *inode)

if (!drop && (sb->s_flags & MS_ACTIVE)) {
inode->i_state |= I_REFERENCED;
if (!(inode->i_state & (I_DIRTY|I_SYNC)))
inode_lru_list_add(inode);
inode_add_lru(inode);
spin_unlock(&inode->i_lock);
return;
}
Expand Down
1 change: 1 addition & 0 deletions trunk/fs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ extern int open_check_o_direct(struct file *f);
* inode.c
*/
extern spinlock_t inode_sb_list_lock;
extern void inode_add_lru(struct inode *inode);

/*
* fs-writeback.c
Expand Down

0 comments on commit ca2dbcd

Please sign in to comment.