Re: [RFC PATCH] vfs: optimization to /proc/<pid>/mountinfo patch

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

 



> 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 <linuxram@xxxxxxxxxx>
> ---
>  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-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux