Messages in this thread |  | | Date | Wed, 01 Feb 2012 23:35:27 +0100 | | From | Jiri Slaby <> | | 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
|  |