]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - fs/nfs/proc.c
NFS: Remove use of the Big Kernel Lock around calls to rpc_call_sync
[mv-sheeva.git] / fs / nfs / proc.c
index 9dd85cac2df0130ebd1228f6681848794d3bd69d..7a9013dd5d0aa6ae86df4986e8e58eb75ebf6a00 100644 (file)
 #include <linux/nfs_page.h>
 #include <linux/lockd/bind.h>
 #include <linux/smp_lock.h>
+#include "internal.h"
 
 #define NFSDBG_FACILITY                NFSDBG_PROC
 
-extern struct rpc_procinfo nfs_procedures[];
-
 /*
  * Bare-bones access to getattr: this is for nfs_read_super.
  */
@@ -67,14 +66,14 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
 
        dprintk("%s: call getattr\n", __FUNCTION__);
        nfs_fattr_init(fattr);
-       status = rpc_call_sync(server->client_sys, &msg, 0);
+       status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0);
        dprintk("%s: reply getattr: %d\n", __FUNCTION__, status);
        if (status)
                return status;
        dprintk("%s: call statfs\n", __FUNCTION__);
        msg.rpc_proc = &nfs_procedures[NFSPROC_STATFS];
        msg.rpc_resp = &fsinfo;
-       status = rpc_call_sync(server->client_sys, &msg, 0);
+       status = rpc_call_sync(server->nfs_client->cl_rpcclient, &msg, 0);
        dprintk("%s: reply statfs: %d\n", __FUNCTION__, status);
        if (status)
                return status;
@@ -353,7 +352,7 @@ nfs_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *
 {
        struct nfs_diropargs    *arg;
 
-       arg = (struct nfs_diropargs *)kmalloc(sizeof(*arg), GFP_KERNEL);
+       arg = kmalloc(sizeof(*arg), GFP_KERNEL);
        if (!arg)
                return -ENOMEM;
        arg->fh = NFS_FH(dir->d_inode);
@@ -426,16 +425,17 @@ nfs_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
 }
 
 static int
-nfs_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
-                struct iattr *sattr, struct nfs_fh *fhandle,
-                struct nfs_fattr *fattr)
+nfs_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page,
+                unsigned int len, struct iattr *sattr)
 {
+       struct nfs_fh fhandle;
+       struct nfs_fattr fattr;
        struct nfs_symlinkargs  arg = {
                .fromfh         = NFS_FH(dir),
-               .fromname       = name->name,
-               .fromlen        = name->len,
-               .topath         = path->name,
-               .tolen          = path->len,
+               .fromname       = dentry->d_name.name,
+               .fromlen        = dentry->d_name.len,
+               .pages          = &page,
+               .pathlen        = len,
                .sattr          = sattr
        };
        struct rpc_message msg = {
@@ -444,13 +444,25 @@ nfs_proc_symlink(struct inode *dir, struct qstr *name, struct qstr *path,
        };
        int                     status;
 
-       if (path->len > NFS2_MAXPATHLEN)
+       if (len > NFS2_MAXPATHLEN)
                return -ENAMETOOLONG;
-       dprintk("NFS call  symlink %s -> %s\n", name->name, path->name);
-       nfs_fattr_init(fattr);
-       fhandle->size = 0;
+
+       dprintk("NFS call  symlink %s\n", dentry->d_name.name);
+
        status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
        nfs_mark_for_revalidate(dir);
+
+       /*
+        * V2 SYMLINK requests don't return any attributes.  Setting the
+        * filehandle size to zero indicates to nfs_instantiate that it
+        * should fill in the data with a LOOKUP call on the wire.
+        */
+       if (status == 0) {
+               nfs_fattr_init(&fattr);
+               fhandle.size = 0;
+               status = nfs_instantiate(dentry, &fhandle, &fattr);
+       }
+
        dprintk("NFS reply symlink: %d\n", status);
        return status;
 }
@@ -533,13 +545,10 @@ nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
        };
        int                     status;
 
-       lock_kernel();
-
        dprintk("NFS call  readdir %d\n", (unsigned int)cookie);
        status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
 
        dprintk("NFS reply readdir: %d\n", status);
-       unlock_kernel();
        return status;
 }
 
@@ -611,8 +620,6 @@ nfs_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
        return 0;
 }
 
-extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int);
-
 static int nfs_read_done(struct rpc_task *task, struct nfs_read_data *data)
 {
        if (task->tk_status >= 0) {
@@ -674,7 +681,7 @@ nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
 }
 
 
-struct nfs_rpc_ops     nfs_v2_clientops = {
+const struct nfs_rpc_ops nfs_v2_clientops = {
        .version        = 2,                   /* protocol version */
        .dentry_ops     = &nfs_dentry_operations,
        .dir_inode_ops  = &nfs_dir_inode_operations,