Re: [RFC PATCH] vfs: optimization to /proc//mountinfo patch
On Mon, 2008-02-04 at 01:28 -0800, Andrew Morton wrote: > On Mon, 04 Feb 2008 01:15:05 -0800 Ram Pai <[EMAIL PROTECTED]> wrote: > > > 1) reports deleted inode in dentry_path() consistent with that in __d_path() > > 2) modified __d_path() to use prepend(), reducing the size of __d_path() > > 3) moved all the functionality that reports mount information in /proc under > > CONFIG_PROC_FS. > > > > Could not verify if the code would work with CONFIG_PROC_FS=n, since it was > > impossible to disable CONFIG_PROC_FS. Looking for ideas on how to disable > > CONFIG_PROC_FS. this worked. thanks. There was one place in ipv4 that failed compilation with proc_fs disabled. Fixed that. Otherwise everything compiled cleanly. > > Do `make menuconfig', then hit '/' and search for "proc_fs". > > It'll tell you that you need to set EMBEDDED=y to disable procfs. > > > fs/dcache.c | 59 > > +++ > > fs/namespace.c |2 + > > fs/seq_file.c|2 + > > include/linux/dcache.h |3 ++ > > include/linux/seq_file.h |3 ++ > > Please resend after testing that, thanks. with procfs disabled, the boot fails, since nash(fedora's startup script) which links with libc.so library has dependencies on /proc. Nash segfaults and so does init. looking for ideas. without passing this hurdle, its hard to test the patch :( RP -- 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/
Re: [RFC PATCH] vfs: optimization to /proc//mountinfo patch
> 1) reports deleted inode in dentry_path() consistent with that in __d_path() > 2) modified __d_path() to use prepend(), reducing the size of __d_path() > 3) moved all the functionality that reports mount information in /proc under > CONFIG_PROC_FS. > > Could not verify if the code would work with CONFIG_PROC_FS=n, since it was > impossible to disable CONFIG_PROC_FS. Looking for ideas on how to disable > CONFIG_PROC_FS. > > > > Signed-off-by: Ram Pai <[EMAIL PROTECTED]> > --- > fs/dcache.c | 59 > +++ > fs/namespace.c |2 + > fs/seq_file.c|2 + > include/linux/dcache.h |3 ++ > include/linux/seq_file.h |3 ++ > 5 files changed, 34 insertions(+), 35 deletions(-) > > Index: linux-2.6.23/fs/dcache.c > === > --- linux-2.6.23.orig/fs/dcache.c > +++ linux-2.6.23/fs/dcache.c > @@ -1747,6 +1747,17 @@ shouldnt_be_hashed: > goto shouldnt_be_hashed; > } > > +static int prepend(char **buffer, int *buflen, const char *str, > + int namelen) > +{ > + *buflen -= namelen; > + if (*buflen < 0) > + return 1; This is confusing. Should return -ENAMETOOLONG intead (see Chapter 16 in Documentation/CodingStyle). > + *buffer -= namelen; > + memcpy(*buffer, str, namelen); > + return 0; > +} > + > /** > * d_path - return the path of a dentry > * @dentry: dentry to report > @@ -1768,17 +1779,11 @@ static char *__d_path(struct dentry *den > { > char * end = buffer+buflen; > char * retval; > - int namelen; > > - *--end = '\0'; > - buflen--; > - if (!IS_ROOT(dentry) && d_unhashed(dentry)) { > - buflen -= 10; > - end -= 10; > - if (buflen < 0) > + prepend(&end, &buflen, "\0", 1); > + if (!IS_ROOT(dentry) && d_unhashed(dentry) && > + prepend(&end, &buflen, " (deleted)", 10)) And this should test for "prepend() != 0" or "prepend() < 0" instead, otherwise it could easily be misread as "if prepend() succeeded, then...". And similarly for all the later calls. Thanks, Miklos -- 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/
Re: [RFC PATCH] vfs: optimization to /proc//mountinfo patch
On Mon, 04 Feb 2008 01:15:05 -0800 Ram Pai <[EMAIL PROTECTED]> wrote: > 1) reports deleted inode in dentry_path() consistent with that in __d_path() > 2) modified __d_path() to use prepend(), reducing the size of __d_path() > 3) moved all the functionality that reports mount information in /proc under > CONFIG_PROC_FS. > > Could not verify if the code would work with CONFIG_PROC_FS=n, since it was > impossible to disable CONFIG_PROC_FS. Looking for ideas on how to disable > CONFIG_PROC_FS. > Do `make menuconfig', then hit '/' and search for "proc_fs". It'll tell you that you need to set EMBEDDED=y to disable procfs. > fs/dcache.c | 59 > +++ > fs/namespace.c |2 + > fs/seq_file.c|2 + > include/linux/dcache.h |3 ++ > include/linux/seq_file.h |3 ++ Please resend after testing that, thanks. -- 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/
[RFC PATCH] vfs: optimization to /proc//mountinfo patch
1) reports deleted inode in dentry_path() consistent with that in __d_path() 2) modified __d_path() to use prepend(), reducing the size of __d_path() 3) moved all the functionality that reports mount information in /proc under CONFIG_PROC_FS. Could not verify if the code would work with CONFIG_PROC_FS=n, since it was impossible to disable CONFIG_PROC_FS. Looking for ideas on how to disable CONFIG_PROC_FS. Signed-off-by: Ram Pai <[EMAIL PROTECTED]> --- fs/dcache.c | 59 +++ fs/namespace.c |2 + fs/seq_file.c|2 + include/linux/dcache.h |3 ++ include/linux/seq_file.h |3 ++ 5 files changed, 34 insertions(+), 35 deletions(-) Index: linux-2.6.23/fs/dcache.c === --- linux-2.6.23.orig/fs/dcache.c +++ linux-2.6.23/fs/dcache.c @@ -1747,6 +1747,17 @@ shouldnt_be_hashed: goto shouldnt_be_hashed; } +static int prepend(char **buffer, int *buflen, const char *str, + int namelen) +{ + *buflen -= namelen; + if (*buflen < 0) + return 1; + *buffer -= namelen; + memcpy(*buffer, str, namelen); + return 0; +} + /** * d_path - return the path of a dentry * @dentry: dentry to report @@ -1768,17 +1779,11 @@ static char *__d_path(struct dentry *den { char * end = buffer+buflen; char * retval; - int namelen; - *--end = '\0'; - buflen--; - if (!IS_ROOT(dentry) && d_unhashed(dentry)) { - buflen -= 10; - end -= 10; - if (buflen < 0) + prepend(&end, &buflen, "\0", 1); + if (!IS_ROOT(dentry) && d_unhashed(dentry) && + prepend(&end, &buflen, " (deleted)", 10)) goto Elong; - memcpy(end, " (deleted)", 10); - } if (buflen < 1) goto Elong; @@ -1805,13 +1810,10 @@ static char *__d_path(struct dentry *den } parent = dentry->d_parent; prefetch(parent); - namelen = dentry->d_name.len; - buflen -= namelen + 1; - if (buflen < 0) + if (prepend(&end, &buflen, dentry->d_name.name, + dentry->d_name.len) || + prepend(&end, &buflen, "/", 1)) goto Elong; - end -= namelen; - memcpy(end, dentry->d_name.name, namelen); - *--end = '/'; retval = end; dentry = parent; } @@ -1819,12 +1821,9 @@ static char *__d_path(struct dentry *den return retval; global_root: - namelen = dentry->d_name.len; - buflen -= namelen; - if (buflen < 0) - goto Elong; - retval -= namelen-1;/* hit the slash */ - memcpy(retval, dentry->d_name.name, namelen); + retval += 1;/* hit the slash */ + if (prepend(&retval, &buflen, dentry->d_name.name, dentry->d_name.len)) + goto Elong; return retval; Elong: return ERR_PTR(-ENAMETOOLONG); @@ -1890,17 +1889,8 @@ char *dynamic_dname(struct dentry *dentr return memcpy(buffer, temp, sz); } -static int prepend(char **buffer, int *buflen, const char *str, - int namelen) -{ - *buflen -= namelen; - if (*buflen < 0) - return 1; - *buffer -= namelen; - memcpy(*buffer, str, namelen); - return 0; -} +#ifdef CONFIG_PROC_FS /* * Write full pathname from the root of the filesystem into the buffer. */ @@ -1910,11 +1900,9 @@ char *dentry_path(struct dentry *dentry, char *retval; spin_lock(&dcache_lock); - prepend(&end, &buflen, "\0", 1); - if (!IS_ROOT(dentry) && d_unhashed(dentry)) { - if (prepend(&end, &buflen, "//deleted", 9)) + if (!IS_ROOT(dentry) && d_unhashed(dentry) && + prepend(&end, &buflen, " (deleted)", 10)) goto Elong; - } if (buflen < 1) goto Elong; /* Get '/' right */ @@ -1943,6 +1931,7 @@ Elong: spin_unlock(&dcache_lock); return ERR_PTR(-ENAMETOOLONG); } +#endif /* CONFIG_PROC_FS */ /* * NOTE! The user-level library version returns a Index: linux-2.6.23/fs/namespace.c === --- linux-2.6.23.orig/fs/namespace.c +++ linux-2.6.23/fs/namespace.c @@ -609,6 +609,7 @@ void mnt_unpin(struct vfsmount *mnt) EXPORT_SYMBOL(mnt_unpin); +#ifdef CONFIG_PROC_FS /* iterator */ static void *m_start(struct seq_file *m, loff_t *pos) { @@ -795,6 +796,7 @@ const struct seq_operations mountstats_o .stop = m_stop, .show = show_vfsstat, }; +#endif /* CONFIG_PROC_FS */ /** * may_umount_tree - check if a mount tree is busy Index: linux-2.6.