diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-07-25 00:31:46 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 22:49:02 +0200 |
commit | dca332528bc69e05f67161e1ed59929633d5e63d (patch) | |
tree | 0ec5576d52bead57c73983d2412cfe71814b5f8d /fs/dcache.c | |
parent | Fix sget() race with failing mount (diff) | |
download | linux-dca332528bc69e05f67161e1ed59929633d5e63d.tar.xz linux-dca332528bc69e05f67161e1ed59929633d5e63d.zip |
no need for list_for_each_entry_safe()/resetting with superblock list
just delay __put_super() a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index caf08574982f..9f2c13417969 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -536,7 +536,7 @@ restart: */ static void prune_dcache(int count) { - struct super_block *sb, *n; + struct super_block *sb, *p = NULL; int w_count; int unused = dentry_stat.nr_unused; int prune_ratio; @@ -550,7 +550,7 @@ static void prune_dcache(int count) else prune_ratio = unused / count; spin_lock(&sb_lock); - list_for_each_entry_safe(sb, n, &super_blocks, s_list) { + list_for_each_entry(sb, &super_blocks, s_list) { if (list_empty(&sb->s_instances)) continue; if (sb->s_nr_dentry_unused == 0) @@ -590,14 +590,16 @@ static void prune_dcache(int count) up_read(&sb->s_umount); } spin_lock(&sb_lock); - /* lock was dropped, must reset next */ - list_safe_reset_next(sb, n, s_list); + if (p) + __put_super(p); count -= pruned; - __put_super(sb); + p = sb; /* more work left to do? */ if (count <= 0) break; } + if (p) + __put_super(p); spin_unlock(&sb_lock); spin_unlock(&dcache_lock); } |