From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Chinner Subject: Re: [PATCH 3/4] dcache set size Date: Sun, 31 Jul 2011 11:38:43 +1000 Message-ID: <20110731013843.GN5404@dastard> References: <1311947059-17209-1-git-send-email-glommer@parallels.com> <1311947059-17209-4-git-send-email-glommer@parallels.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, containers@lists.linux-foundation.org, Pavel Emelyanov , Al Viro , Hugh Dickins , Nick Piggin , Andrea Arcangeli , Rik van Riel , Dave Hansen , James Bottomley To: Glauber Costa Return-path: Received: from ipmail06.adl6.internode.on.net ([150.101.137.145]:54202 "EHLO ipmail06.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752711Ab1GaBir (ORCPT ); Sat, 30 Jul 2011 21:38:47 -0400 Content-Disposition: inline In-Reply-To: <1311947059-17209-4-git-send-email-glommer@parallels.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Jul 29, 2011 at 05:44:18PM +0400, Glauber Costa wrote: > Simple patch that provides a function allowing its caller to set > the maximum number of dentries that can exist at the same time > at a given super block. Will be used in a later patch. Pretty simple - probably better to put it in the patch that uses it, I think. > Signed-off-by: Glauber Costa > CC: Dave Chinner > --- > fs/dcache.c | 12 ++++++++++++ > include/linux/dcache.h | 1 + > 2 files changed, 13 insertions(+), 0 deletions(-) > > diff --git a/fs/dcache.c b/fs/dcache.c > index 3bdb106..4369aa2 100644 > --- a/fs/dcache.c > +++ b/fs/dcache.c > @@ -1202,6 +1202,18 @@ static int dcache_mem_check(struct super_block *sb) > return -ENOMEM; > } > > +int vfs_set_dcache_size(struct super_block *sb, int size) > +{ > + unsigned long dr = percpu_counter_sum_positive(&sb->s_nr_dentry); > + > + if (size != sb->s_nr_dentry_max) > + prune_dcache_sb(sb, dr - size); And why shrink if the new size > the current sb->s_nr_dentry_max? And what happens when size > dr? Cheers, Dave. -- Dave Chinner david@fromorbit.com