aboutsummaryrefslogtreecommitdiffstats
path: root/fs/drop_caches.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/drop_caches.c')
-rw-r--r--fs/drop_caches.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index 52047cf4177f..83c4f600786a 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -8,12 +8,11 @@
8#include <linux/writeback.h> 8#include <linux/writeback.h>
9#include <linux/sysctl.h> 9#include <linux/sysctl.h>
10#include <linux/gfp.h> 10#include <linux/gfp.h>
11#include "internal.h"
12 11
13/* A global variable is a bit ugly, but it keeps the code simple */ 12/* A global variable is a bit ugly, but it keeps the code simple */
14int sysctl_drop_caches; 13int sysctl_drop_caches;
15 14
16static void drop_pagecache_sb(struct super_block *sb) 15static void drop_pagecache_sb(struct super_block *sb, void *unused)
17{ 16{
18 struct inode *inode, *toput_inode = NULL; 17 struct inode *inode, *toput_inode = NULL;
19 18
@@ -34,26 +33,6 @@ static void drop_pagecache_sb(struct super_block *sb)
34 iput(toput_inode); 33 iput(toput_inode);
35} 34}
36 35
37static void drop_pagecache(void)
38{
39 struct super_block *sb, *n;
40
41 spin_lock(&sb_lock);
42 list_for_each_entry_safe(sb, n, &super_blocks, s_list) {
43 if (list_empty(&sb->s_instances))
44 continue;
45 sb->s_count++;
46 spin_unlock(&sb_lock);
47 down_read(&sb->s_umount);
48 if (sb->s_root)
49 drop_pagecache_sb(sb);
50 up_read(&sb->s_umount);
51 spin_lock(&sb_lock);
52 __put_super(sb);
53 }
54 spin_unlock(&sb_lock);
55}
56
57static void drop_slab(void) 36static void drop_slab(void)
58{ 37{
59 int nr_objects; 38 int nr_objects;
@@ -69,7 +48,7 @@ int drop_caches_sysctl_handler(ctl_table *table, int write,
69 proc_dointvec_minmax(table, write, buffer, length, ppos); 48 proc_dointvec_minmax(table, write, buffer, length, ppos);
70 if (write) { 49 if (write) {
71 if (sysctl_drop_caches & 1) 50 if (sysctl_drop_caches & 1)
72 drop_pagecache(); 51 iterate_supers(drop_pagecache_sb, NULL);
73 if (sysctl_drop_caches & 2) 52 if (sysctl_drop_caches & 2)
74 drop_slab(); 53 drop_slab();
75 } 54 }