diff options
author | Dave Chinner <dchinner@redhat.com> | 2012-03-22 01:15:10 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-03-26 18:19:08 -0400 |
commit | 5132ba8f2b7705fb6b06fa6ad3d009233c816b67 (patch) | |
tree | e552a365b600af005abec13f3a1deb1f57bae3b9 /fs/xfs/xfs_super.c | |
parent | f616137519feb17b849894fcbe634a021d3fa7db (diff) |
xfs: don't cache inodes read through bulkstat
When we read inodes via bulkstat, we generally only read them once
and then throw them away - they never get used again. If we retain
them in cache, then it simply causes the working set of inodes and
other cached items to be reclaimed just so the inode cache can grow.
Avoid this problem by marking inodes read by bulkstat not to be
cached and check this flag in .drop_inode to determine whether the
inode should be added to the VFS LRU or not. If the inode lookup
hits an already cached inode, then don't set the flag. If the inode
lookup hits an inode marked with no cache flag, remove the flag and
allow it to be cached once the current reference goes away.
Inodes marked as not cached will get cleaned up by the background
inode reclaim or via memory pressure, so they will still generate
some short term cache pressure. They will, however, be reclaimed
much sooner and in preference to cache hot inodes.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_super.c')
-rw-r--r-- | fs/xfs/xfs_super.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 5484888d39c4..e1c623b43ab2 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c | |||
@@ -950,6 +950,22 @@ xfs_fs_evict_inode( | |||
950 | xfs_inactive(ip); | 950 | xfs_inactive(ip); |
951 | } | 951 | } |
952 | 952 | ||
953 | /* | ||
954 | * We do an unlocked check for XFS_IDONTCACHE here because we are already | ||
955 | * serialised against cache hits here via the inode->i_lock and igrab() in | ||
956 | * xfs_iget_cache_hit(). Hence a lookup that might clear this flag will not be | ||
957 | * racing with us, and it avoids needing to grab a spinlock here for every inode | ||
958 | * we drop the final reference on. | ||
959 | */ | ||
960 | STATIC int | ||
961 | xfs_fs_drop_inode( | ||
962 | struct inode *inode) | ||
963 | { | ||
964 | struct xfs_inode *ip = XFS_I(inode); | ||
965 | |||
966 | return generic_drop_inode(inode) || (ip->i_flags & XFS_IDONTCACHE); | ||
967 | } | ||
968 | |||
953 | STATIC void | 969 | STATIC void |
954 | xfs_free_fsname( | 970 | xfs_free_fsname( |
955 | struct xfs_mount *mp) | 971 | struct xfs_mount *mp) |
@@ -1434,6 +1450,7 @@ static const struct super_operations xfs_super_operations = { | |||
1434 | .destroy_inode = xfs_fs_destroy_inode, | 1450 | .destroy_inode = xfs_fs_destroy_inode, |
1435 | .dirty_inode = xfs_fs_dirty_inode, | 1451 | .dirty_inode = xfs_fs_dirty_inode, |
1436 | .evict_inode = xfs_fs_evict_inode, | 1452 | .evict_inode = xfs_fs_evict_inode, |
1453 | .drop_inode = xfs_fs_drop_inode, | ||
1437 | .put_super = xfs_fs_put_super, | 1454 | .put_super = xfs_fs_put_super, |
1438 | .sync_fs = xfs_fs_sync_fs, | 1455 | .sync_fs = xfs_fs_sync_fs, |
1439 | .freeze_fs = xfs_fs_freeze, | 1456 | .freeze_fs = xfs_fs_freeze, |