Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ac91378 authored by Jan Blunck's avatar Jan Blunck Committed by Linus Torvalds
Browse files

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: default avatarJan Blunck <jblunck@suse.de>
Signed-off-by: default avatarAndreas Gruenbacher <agruen@suse.de>
Acked-by: default avatarChristoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c5e725f3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -259,7 +259,7 @@ osf_statfs(char __user *path, struct osf_statfs __user *buffer, unsigned long bu

	retval = user_path_walk(path, &nd);
	if (!retval) {
		retval = do_osf_statfs(nd.dentry, buffer, bufsiz);
		retval = do_osf_statfs(nd.path.dentry, buffer, bufsiz);
		path_release(&nd);
	}
	return retval;
+3 −3
Original line number Diff line number Diff line
@@ -694,7 +694,7 @@ asmlinkage int irix_statfs(const char __user *path,
	if (error)
		goto out;

	error = vfs_statfs(nd.dentry, &kbuf);
	error = vfs_statfs(nd.path.dentry, &kbuf);
	if (error)
		goto dput_and_out;

@@ -1360,7 +1360,7 @@ asmlinkage int irix_statvfs(char __user *fname, struct irix_statvfs __user *buf)
	error = user_path_walk(fname, &nd);
	if (error)
		goto out;
	error = vfs_statfs(nd.dentry, &kbuf);
	error = vfs_statfs(nd.path.dentry, &kbuf);
	if (error)
		goto dput_and_out;

@@ -1611,7 +1611,7 @@ asmlinkage int irix_statvfs64(char __user *fname, struct irix_statvfs64 __user *
	error = user_path_walk(fname, &nd);
	if (error)
		goto out;
	error = vfs_statfs(nd.dentry, &kbuf);
	error = vfs_statfs(nd.path.dentry, &kbuf);
	if (error)
		goto dput_and_out;

+1 −1
Original line number Diff line number Diff line
@@ -219,7 +219,7 @@ asmlinkage long hpux_statfs(const char __user *path,
	error = user_path_walk(path, &nd);
	if (!error) {
		struct hpux_statfs tmp;
		error = vfs_statfs_hpux(nd.dentry, &tmp);
		error = vfs_statfs_hpux(nd.path.dentry, &tmp);
		if (!error && copy_to_user(buf, &tmp, sizeof(tmp)))
			error = -EFAULT;
		path_release(&nd);
+10 −8
Original line number Diff line number Diff line

/*
 * 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;
}
+4 −4
Original line number Diff line number Diff line
@@ -434,8 +434,8 @@ asmlinkage int solaris_statvfs(u32 path, u32 buf)

	error = user_path_walk(A(path),&nd);
	if (!error) {
		struct inode * inode = nd.dentry->d_inode;
		error = report_statvfs(nd.mnt, inode, buf);
		struct inode *inode = nd.path.dentry->d_inode;
		error = report_statvfs(nd.path.mnt, inode, buf);
		path_release(&nd);
	}
	return error;
@@ -464,8 +464,8 @@ asmlinkage int solaris_statvfs64(u32 path, u32 buf)
	lock_kernel();
	error = user_path_walk(A(path), &nd);
	if (!error) {
		struct inode * inode = nd.dentry->d_inode;
		error = report_statvfs64(nd.mnt, inode, buf);
		struct inode *inode = nd.path.dentry->d_inode;
		error = report_statvfs64(nd.path.mnt, inode, buf);
		path_release(&nd);
	}
	unlock_kernel();
Loading