Re: [PATCH 3/4] fs: Lock the inode LRU list separately

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 27, 2010 at 05:05:30AM -0400, Christoph Hellwig wrote:
> > @@ -537,15 +545,10 @@ void evict_inodes(struct super_block *sb)
> >  		}
> >  
> >  		inode->i_state |= I_FREEING;
> > -		if (!(inode->i_state & (I_DIRTY | I_SYNC)))
> > -			percpu_counter_dec(&nr_inodes_unused);
> > +		inode_lru_list_del(inode);
> >  		spin_unlock(&inode->i_lock);
> >  
> > -		/*
> > -		 * Move the inode off the IO lists and LRU once I_FREEING is
> > -		 * set so that it won't get moved back on there if it is dirty.
> > -		 */
> > -		list_move(&inode->i_lru, &dispose);
> > +		list_add(&inode->i_lru, &dispose);
> >  	}
> >  	spin_unlock(&inode_lock);
> >  
> > @@ -582,15 +585,10 @@ int invalidate_inodes(struct super_block *sb)
> >  		}
> >  
> >  		inode->i_state |= I_FREEING;
> > -		if (!(inode->i_state & (I_DIRTY | I_SYNC)))
> > -			percpu_counter_dec(&nr_inodes_unused);
> > +		inode_lru_list_del(inode);
> >  		spin_unlock(&inode->i_lock);
> 
> with this scheme we now decrement nr_inodes_unused twice - once in
> invalidate_inodes/evict_inodes and once in dispose_one_inode. 

That doesn't happen because the counter is only modified when
the inode is moved on/off the list and there are checks to avoid
removing an inode that is not on the list. Also, the inode is not
removed from the LRU in dispose_one_inode - it is always done when
the inode is marked I_FREEING while the i_lock is held before
calling dispose_one_inode().

Basically I wanted to remove the strange "inode is not on the LRU if
it is dirty or under writeback" accounting checks and make the
accounting symmetric with adding/removing the inodes from the LRU.
These are protected by list_empty() checks, so should always end up
with the correct accounting.

hence the only special case now is prune_icache() which already
holds the inode_lru_lock() so can't call the helper. Besides, we
don't need any checks there because we know the inode is on the LRU
already....

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux