Embed a struct path into struct nameidata instead of nd->{dentry,mnt}
This is the central patch of a cleanup series. In most cases there is no good
reason why someone would want to use a dentry for itself. This series reflects
that fact and embeds a struct path into nameidata.
Together with the other patches of this series
- it enforced the correct order of getting/releasing the reference count on
<dentry,vfsmount> pairs
- it prepares the VFS for stacking support since it is essential to have a
struct path in every place where the stack can be traversed
- it reduces the overall code size:
without patch series:
text data bss dec hex filename
5321639 858418 715768 6895825 6938d1 vmlinux
with patch series:
text data bss dec hex filename
5320026 858418 715768 6894212
693284 vmlinux
This patch:
Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix cifs]
[akpm@linux-foundation.org: fix smack]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
c5e725f33b
commit
4ac9137858
@@ -1,3 +1,4 @@
|
||||
|
||||
/*
|
||||
* SPU file system
|
||||
*
|
||||
@@ -592,7 +593,7 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode,
|
||||
|
||||
ret = -EINVAL;
|
||||
/* check if we are on spufs */
|
||||
if (nd->dentry->d_sb->s_type != &spufs_type)
|
||||
if (nd->path.dentry->d_sb->s_type != &spufs_type)
|
||||
goto out;
|
||||
|
||||
/* don't accept undefined flags */
|
||||
@@ -600,9 +601,9 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode,
|
||||
goto out;
|
||||
|
||||
/* only threads can be underneath a gang */
|
||||
if (nd->dentry != nd->dentry->d_sb->s_root) {
|
||||
if (nd->path.dentry != nd->path.dentry->d_sb->s_root) {
|
||||
if ((flags & SPU_CREATE_GANG) ||
|
||||
!SPUFS_I(nd->dentry->d_inode)->i_gang)
|
||||
!SPUFS_I(nd->path.dentry->d_inode)->i_gang)
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -618,16 +619,17 @@ long spufs_create(struct nameidata *nd, unsigned int flags, mode_t mode,
|
||||
mode &= ~current->fs->umask;
|
||||
|
||||
if (flags & SPU_CREATE_GANG)
|
||||
return spufs_create_gang(nd->dentry->d_inode,
|
||||
dentry, nd->mnt, mode);
|
||||
return spufs_create_gang(nd->path.dentry->d_inode,
|
||||
dentry, nd->path.mnt, mode);
|
||||
else
|
||||
return spufs_create_context(nd->dentry->d_inode,
|
||||
dentry, nd->mnt, flags, mode, filp);
|
||||
return spufs_create_context(nd->path.dentry->d_inode,
|
||||
dentry, nd->path.mnt, flags, mode,
|
||||
filp);
|
||||
|
||||
out_dput:
|
||||
dput(dentry);
|
||||
out_dir:
|
||||
mutex_unlock(&nd->dentry->d_inode->i_mutex);
|
||||
mutex_unlock(&nd->path.dentry->d_inode->i_mutex);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user