Re: [patch 4/5] vfs: per superblock dentry stats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 26, 2006 at 01:06:59PM +0200, Jan Blunck wrote:
> Index: work-2.6/fs/super.c
> ===================================================================
> --- work-2.6.orig/fs/super.c
> +++ work-2.6/fs/super.c
> @@ -71,6 +71,9 @@ static struct super_block *alloc_super(v
>  		INIT_LIST_HEAD(&s->s_instances);
>  		INIT_HLIST_HEAD(&s->s_anon);
>  		INIT_LIST_HEAD(&s->s_inodes);
> +		s->s_dentry_stat.nr_dentry = 0;
> +		s->s_dentry_stat.nr_unused = 0;

No need for these as the superblock is memset to zero....

> -struct dentry_stat_t {
> +struct dentry_stat {
>  	int nr_dentry;
>  	int nr_unused;
> -	int age_limit;          /* age in seconds */
> -	int want_pages;         /* pages requested by system */
> -	int dummy[2];
> +	int age_limit;		/* age in seconds */
>  };

that changes the size of the structure from 6*sizeof(int) to
3*sizeof(int)....

> -extern struct dentry_stat_t dentry_stat;
> +extern struct dentry_stat global_dentry_stat;
> +
> +#define dentry_stat_inc(sb, x)		\
> +do {					\
> +	global_dentry_stat.x++;		\
> +	if (sb)				\
> +		(sb)->s_dentry_stat.x++;\
> +} while(0)
> +
> +#define dentry_stat_dec(sb, x)		\
> +do {					\
> +	global_dentry_stat.x--;		\
> +	if (sb)				\
> +		(sb)->s_dentry_stat.x--;\
> +} while(0)

	if (likely(sb))  ???

> Index: work-2.6/kernel/sysctl.c
> ===================================================================
> --- work-2.6.orig/kernel/sysctl.c
> +++ work-2.6/kernel/sysctl.c
> @@ -958,7 +958,7 @@ static ctl_table fs_table[] = {
>  	{
>  		.ctl_name	= FS_DENTRY,
>  		.procname	= "dentry-state",
> -		.data		= &dentry_stat,
> +		.data		= &global_dentry_stat,
>  		.maxlen		= 6*sizeof(int),

With the above change, maxlen = 3*sizeof(int).

Given that's a userspace visible change, should the above structure
change use a "int dummy[3];" to keep the global structure and userspace
export the same?

Cheers,

Dave.
-- 
Dave Chinner
R&D Software Enginner
SGI Australian Software Group
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux