aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorJan Blunck <jblunck@suse.de>2008-02-14 22:34:38 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-15 00:13:33 -0500
commit6ac08c39a16f72c2d3e845cb6849a1392fa03e80 (patch)
treed7603571e9ab3ea4b57b7901211320e48d0c5ed8 /fs/dcache.c
parent5dd784d04924be5d8bc066aded0ec3274b20e612 (diff)
Use struct path in fs_struct
* Use struct path in fs_struct. Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Signed-off-by: Jan Blunck <jblunck@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r--fs/dcache.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 44f6cf23b70e..66aaf52199e9 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1849,8 +1849,7 @@ char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
1849 char *buf, int buflen) 1849 char *buf, int buflen)
1850{ 1850{
1851 char *res; 1851 char *res;
1852 struct vfsmount *rootmnt; 1852 struct path root;
1853 struct dentry *root;
1854 1853
1855 /* 1854 /*
1856 * We have various synthetic filesystems that never get mounted. On 1855 * We have various synthetic filesystems that never get mounted. On
@@ -1863,14 +1862,13 @@ char * d_path(struct dentry *dentry, struct vfsmount *vfsmnt,
1863 return dentry->d_op->d_dname(dentry, buf, buflen); 1862 return dentry->d_op->d_dname(dentry, buf, buflen);
1864 1863
1865 read_lock(&current->fs->lock); 1864 read_lock(&current->fs->lock);
1866 rootmnt = mntget(current->fs->rootmnt); 1865 root = current->fs->root;
1867 root = dget(current->fs->root); 1866 path_get(&current->fs->root);
1868 read_unlock(&current->fs->lock); 1867 read_unlock(&current->fs->lock);
1869 spin_lock(&dcache_lock); 1868 spin_lock(&dcache_lock);
1870 res = __d_path(dentry, vfsmnt, root, rootmnt, buf, buflen); 1869 res = __d_path(dentry, vfsmnt, root.dentry, root.mnt, buf, buflen);
1871 spin_unlock(&dcache_lock); 1870 spin_unlock(&dcache_lock);
1872 dput(root); 1871 path_put(&root);
1873 mntput(rootmnt);
1874 return res; 1872 return res;
1875} 1873}
1876 1874
@@ -1916,28 +1914,28 @@ char *dynamic_dname(struct dentry *dentry, char *buffer, int buflen,
1916asmlinkage long sys_getcwd(char __user *buf, unsigned long size) 1914asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
1917{ 1915{
1918 int error; 1916 int error;
1919 struct vfsmount *pwdmnt, *rootmnt; 1917 struct path pwd, root;
1920 struct dentry *pwd, *root;
1921 char *page = (char *) __get_free_page(GFP_USER); 1918 char *page = (char *) __get_free_page(GFP_USER);
1922 1919
1923 if (!page) 1920 if (!page)
1924 return -ENOMEM; 1921 return -ENOMEM;
1925 1922
1926 read_lock(&current->fs->lock); 1923 read_lock(&current->fs->lock);
1927 pwdmnt = mntget(current->fs->pwdmnt); 1924 pwd = current->fs->pwd;
1928 pwd = dget(current->fs->pwd); 1925 path_get(&current->fs->pwd);
1929 rootmnt = mntget(current->fs->rootmnt); 1926 root = current->fs->root;
1930 root = dget(current->fs->root); 1927 path_get(&current->fs->root);
1931 read_unlock(&current->fs->lock); 1928 read_unlock(&current->fs->lock);
1932 1929
1933 error = -ENOENT; 1930 error = -ENOENT;
1934 /* Has the current directory has been unlinked? */ 1931 /* Has the current directory has been unlinked? */
1935 spin_lock(&dcache_lock); 1932 spin_lock(&dcache_lock);
1936 if (pwd->d_parent == pwd || !d_unhashed(pwd)) { 1933 if (pwd.dentry->d_parent == pwd.dentry || !d_unhashed(pwd.dentry)) {
1937 unsigned long len; 1934 unsigned long len;
1938 char * cwd; 1935 char * cwd;
1939 1936
1940 cwd = __d_path(pwd, pwdmnt, root, rootmnt, page, PAGE_SIZE); 1937 cwd = __d_path(pwd.dentry, pwd.mnt, root.dentry, root.mnt,
1938 page, PAGE_SIZE);
1941 spin_unlock(&dcache_lock); 1939 spin_unlock(&dcache_lock);
1942 1940
1943 error = PTR_ERR(cwd); 1941 error = PTR_ERR(cwd);
@@ -1955,10 +1953,8 @@ asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
1955 spin_unlock(&dcache_lock); 1953 spin_unlock(&dcache_lock);
1956 1954
1957out: 1955out:
1958 dput(pwd); 1956 path_put(&pwd);
1959 mntput(pwdmnt); 1957 path_put(&root);
1960 dput(root);
1961 mntput(rootmnt);
1962 free_page((unsigned long) page); 1958 free_page((unsigned long) page);
1963 return error; 1959 return error;
1964} 1960}