[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F29BE2F.2000907@suse.cz>
Date: Wed, 01 Feb 2012 23:35:27 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
CC: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Greg KH <greg@...ah.com>, Alan Cox <alan@...rguk.ukuu.org.uk>,
LKML <linux-kernel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Maciej Rutecki <maciej.rutecki@...il.com>
Subject: Re: [PATCH] sysfs: Optionally count subdirectories to support buggy
applications
On 02/01/2012 11:21 PM, Eric W. Biederman wrote:
> --- a/fs/sysfs/Kconfig
> +++ b/fs/sysfs/Kconfig
> @@ -21,3 +21,18 @@ config SYSFS
> example, "root=03:01" for /dev/hda1.
>
> Designers of embedded systems may wish to say N here to conserve space.
> +
> +config SYSFS_COUNT_LINKS
> + bool "sysfs count subdirectoires to support buggy applications"
> + default n
> + help
> +
> + Increase the memory and cpu untilization of sysfs by maintaining
> + by maintaining a count of how hard links from subdirectories a
by maintaining only once.
of how "many"?
> + directory has. This allows sysfs to report the directory nlink
> + as the number of subdirectories plus two. With out this enabled
> + sysfs will report the nlink of all directories as 1, which is
> + the standard way of indicating that the number of subdirectoires
> + is not tracked.
> +
> + Unless you know you need this say N here.
You should put the opposite here. "If you are sure you don't need it,
say N."
> --- a/fs/sysfs/sysfs.h
> +++ b/fs/sysfs/sysfs.h
...
> @@ -127,6 +130,41 @@ do { \
> #define sysfs_dirent_init_lockdep(sd) do {} while(0)
> #endif
>
> +#ifdef CONFIG_SYSFS_COUNT_LINKS
> +static inline void sysfs_init_nlink(struct sysfs_dirent *sd)
> +{
> + if (sysfs_type(sd) == SYSFS_DIR)
> + sd->s_nlink = 2;
> + else
> + sd->s_nlink = 1;
> +}
> +static inline void sysfs_inc_nlink(struct sysfs_dirent *sd)
> +{
> + sd->s_nlink++;
> +}
> +static inline void sysfs_dec_nlink(struct sysfs_dirent *sd)
> +{
> + sd->s_nlink++;
> +}
Minus minus.
thanks,
--
js
suse labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists