Skip to content

Commit

Permalink
clean out unused code in dentry pruning
Browse files Browse the repository at this point in the history
It looks like in the end all pruners want parents removed.

So remove unused code and function arguments.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Oct 17, 2007
1 parent 1a159dd commit 85864e1
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,20 +381,17 @@ void d_prune_aliases(struct inode *inode)
* Throw away a dentry - free the inode, dput the parent. This requires that
* the LRU list has already been removed.
*
* If prune_parents is true, try to prune ancestors as well.
* Try to prune ancestors as well. This is necessary to prevent
* quadratic behavior of shrink_dcache_parent(), but is also expected
* to be beneficial in reducing dentry cache fragmentation.
*
* Called with dcache_lock, drops it and then regains.
* Called with dentry->d_lock held, drops it.
*/
static void prune_one_dentry(struct dentry * dentry, int prune_parents)
static void prune_one_dentry(struct dentry * dentry)
{
__d_drop(dentry);
dentry = d_kill(dentry);
if (!prune_parents) {
dput(dentry);
spin_lock(&dcache_lock);
return;
}

/*
* Prune ancestors. Locking is simpler than in dput(),
Expand Down Expand Up @@ -422,7 +419,6 @@ static void prune_one_dentry(struct dentry * dentry, int prune_parents)
* @count: number of entries to try and free
* @sb: if given, ignore dentries for other superblocks
* which are being unmounted.
* @prune_parents: if true, try to prune ancestors as well in one go
*
* Shrink the dcache. This is done when we need
* more memory, or simply when we need to unmount
Expand All @@ -433,7 +429,7 @@ static void prune_one_dentry(struct dentry * dentry, int prune_parents)
* all the dentries are in use.
*/

static void prune_dcache(int count, struct super_block *sb, int prune_parents)
static void prune_dcache(int count, struct super_block *sb)
{
spin_lock(&dcache_lock);
for (; count ; count--) {
Expand Down Expand Up @@ -493,7 +489,7 @@ static void prune_dcache(int count, struct super_block *sb, int prune_parents)
* without taking the s_umount lock (I already hold it).
*/
if (sb && dentry->d_sb == sb) {
prune_one_dentry(dentry, prune_parents);
prune_one_dentry(dentry);
continue;
}
/*
Expand All @@ -508,7 +504,7 @@ static void prune_dcache(int count, struct super_block *sb, int prune_parents)
s_umount = &dentry->d_sb->s_umount;
if (down_read_trylock(s_umount)) {
if (dentry->d_sb->s_root != NULL) {
prune_one_dentry(dentry, prune_parents);
prune_one_dentry(dentry);
up_read(s_umount);
continue;
}
Expand Down Expand Up @@ -579,7 +575,7 @@ void shrink_dcache_sb(struct super_block * sb)
spin_unlock(&dentry->d_lock);
continue;
}
prune_one_dentry(dentry, 1);
prune_one_dentry(dentry);
cond_resched_lock(&dcache_lock);
goto repeat;
}
Expand Down Expand Up @@ -858,7 +854,7 @@ void shrink_dcache_parent(struct dentry * parent)
int found;

while ((found = select_parent(parent)) != 0)
prune_dcache(found, parent->d_sb, 1);
prune_dcache(found, parent->d_sb);
}

/*
Expand All @@ -878,7 +874,7 @@ static int shrink_dcache_memory(int nr, gfp_t gfp_mask)
if (nr) {
if (!(gfp_mask & __GFP_FS))
return -1;
prune_dcache(nr, NULL, 1);
prune_dcache(nr, NULL);
}
return (dentry_stat.nr_unused / 100) * sysctl_vfs_cache_pressure;
}
Expand Down

0 comments on commit 85864e1

Please sign in to comment.