diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-07-25 11:28:19 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-09-22 23:24:29 -0400 |
commit | 979df72e6f963b42ee484f2eca049c3344da0ba7 (patch) | |
tree | f3ba48a16203c899dbe57482c1ff7f1c02e0c9ca /fs/nfs/super.c | |
parent | cfcea3e8c66c2dcde98d5c2693d4bff50b5cac97 (diff) |
NFS: Add an ACCESS cache memory shrinker
A pinned inode may in theory end up filling memory with cached ACCESS
calls. This patch ensures that the VM may shrink away the cache in these
particular cases.
The shrinker works by iterating through the list of inodes on the global
nfs_access_lru_list, and removing the least recently used access
cache entry until it is done (or until the entire cache is empty).
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r-- | fs/nfs/super.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index e8a9bee74d9d..06c321beacfe 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -221,6 +221,8 @@ module_param_call(idmap_cache_timeout, param_set_idmap_timeout, param_get_int, | |||
221 | &nfs_idmap_cache_timeout, 0644); | 221 | &nfs_idmap_cache_timeout, 0644); |
222 | #endif | 222 | #endif |
223 | 223 | ||
224 | static struct shrinker *acl_shrinker; | ||
225 | |||
224 | /* | 226 | /* |
225 | * Register the NFS filesystems | 227 | * Register the NFS filesystems |
226 | */ | 228 | */ |
@@ -240,6 +242,7 @@ int __init register_nfs_fs(void) | |||
240 | if (ret < 0) | 242 | if (ret < 0) |
241 | goto error_2; | 243 | goto error_2; |
242 | #endif | 244 | #endif |
245 | acl_shrinker = set_shrinker(DEFAULT_SEEKS, nfs_access_cache_shrinker); | ||
243 | return 0; | 246 | return 0; |
244 | 247 | ||
245 | #ifdef CONFIG_NFS_V4 | 248 | #ifdef CONFIG_NFS_V4 |
@@ -257,6 +260,8 @@ error_0: | |||
257 | */ | 260 | */ |
258 | void __exit unregister_nfs_fs(void) | 261 | void __exit unregister_nfs_fs(void) |
259 | { | 262 | { |
263 | if (acl_shrinker != NULL) | ||
264 | remove_shrinker(acl_shrinker); | ||
260 | #ifdef CONFIG_NFS_V4 | 265 | #ifdef CONFIG_NFS_V4 |
261 | unregister_filesystem(&nfs4_fs_type); | 266 | unregister_filesystem(&nfs4_fs_type); |
262 | nfs_unregister_sysctl(); | 267 | nfs_unregister_sysctl(); |