fs: Implement lazy LRU updates for inodes
Convert the inode LRU to use lazy updates to reduce lock and cacheline traffic. We avoid moving inodes around in the LRU list during iget/iput operations so these frequent operations don't need to access the LRUs. Instead, we defer the refcount checks to reclaim-time and use a per-inode state flag, I_REFERENCED, to tell reclaim that iget has touched the inode in the past. This means that only reclaim should be touching the LRU with any frequency, hence significantly reducing lock acquisitions and the amount contention on LRU updates. This also removes the inode_in_use list, which means we now only have one list for tracking the inode LRU status. This makes it much simpler to split out the LRU list operations under it's own lock. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -1641,16 +1641,17 @@ struct super_operations {
|
||||
*
|
||||
* Q: What is the difference between I_WILL_FREE and I_FREEING?
|
||||
*/
|
||||
#define I_DIRTY_SYNC 1
|
||||
#define I_DIRTY_DATASYNC 2
|
||||
#define I_DIRTY_PAGES 4
|
||||
#define I_DIRTY_SYNC (1 << 0)
|
||||
#define I_DIRTY_DATASYNC (1 << 1)
|
||||
#define I_DIRTY_PAGES (1 << 2)
|
||||
#define __I_NEW 3
|
||||
#define I_NEW (1 << __I_NEW)
|
||||
#define I_WILL_FREE 16
|
||||
#define I_FREEING 32
|
||||
#define I_CLEAR 64
|
||||
#define I_WILL_FREE (1 << 4)
|
||||
#define I_FREEING (1 << 5)
|
||||
#define I_CLEAR (1 << 6)
|
||||
#define __I_SYNC 7
|
||||
#define I_SYNC (1 << __I_SYNC)
|
||||
#define I_REFERENCED (1 << 8)
|
||||
|
||||
#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
|
||||
|
||||
|
Reference in New Issue
Block a user