[PATCH] slab: remove SLAB_NOFS
[powerpc.git] / fs / nfs / proc.c
index 2b051ab..4529cc4 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;
 }
@@ -611,12 +623,8 @@ nfs_proc_pathconf(struct nfs_server *server, struct nfs_fh *fhandle,
        return 0;
 }
 
-extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int);
-
-static void nfs_read_done(struct rpc_task *task, void *calldata)
+static int nfs_read_done(struct rpc_task *task, struct nfs_read_data *data)
 {
-       struct nfs_read_data *data = calldata;
-
        if (task->tk_status >= 0) {
                nfs_refresh_inode(data->inode, data->res.fattr);
                /* Emulate the eof flag, which isn't normally needed in NFSv2
@@ -625,20 +633,11 @@ static void nfs_read_done(struct rpc_task *task, void *calldata)
                if (data->args.offset + data->args.count >= data->res.fattr->size)
                        data->res.eof = 1;
        }
-       nfs_readpage_result(task, calldata);
+       return 0;
 }
 
-static const struct rpc_call_ops nfs_read_ops = {
-       .rpc_call_done = nfs_read_done,
-       .rpc_release = nfs_readdata_release,
-};
-
-static void
-nfs_proc_read_setup(struct nfs_read_data *data)
+static void nfs_proc_read_setup(struct nfs_read_data *data)
 {
-       struct rpc_task         *task = &data->task;
-       struct inode            *inode = data->inode;
-       int                     flags;
        struct rpc_message      msg = {
                .rpc_proc       = &nfs_procedures[NFSPROC_READ],
                .rpc_argp       = &data->args,
@@ -646,34 +645,18 @@ nfs_proc_read_setup(struct nfs_read_data *data)
                .rpc_cred       = data->cred,
        };
 
-       /* N.B. Do we need to test? Never called for swapfile inode */
-       flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0);
-
-       /* Finalize the task. */
-       rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs_read_ops, data);
-       rpc_call_setup(task, &msg, 0);
+       rpc_call_setup(&data->task, &msg, 0);
 }
 
-static void nfs_write_done(struct rpc_task *task, void *calldata)
+static int nfs_write_done(struct rpc_task *task, struct nfs_write_data *data)
 {
-       struct nfs_write_data *data = calldata;
-
        if (task->tk_status >= 0)
                nfs_post_op_update_inode(data->inode, data->res.fattr);
-       nfs_writeback_done(task, calldata);
+       return 0;
 }
 
-static const struct rpc_call_ops nfs_write_ops = {
-       .rpc_call_done = nfs_write_done,
-       .rpc_release = nfs_writedata_release,
-};
-
-static void
-nfs_proc_write_setup(struct nfs_write_data *data, int how)
+static void nfs_proc_write_setup(struct nfs_write_data *data, int how)
 {
-       struct rpc_task         *task = &data->task;
-       struct inode            *inode = data->inode;
-       int                     flags;
        struct rpc_message      msg = {
                .rpc_proc       = &nfs_procedures[NFSPROC_WRITE],
                .rpc_argp       = &data->args,
@@ -684,12 +667,8 @@ nfs_proc_write_setup(struct nfs_write_data *data, int how)
        /* Note: NFSv2 ignores @stable and always uses NFS_FILE_SYNC */
        data->args.stable = NFS_FILE_SYNC;
 
-       /* Set the initial flags for the task.  */
-       flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
-
        /* Finalize the task. */
-       rpc_init_task(task, NFS_CLIENT(inode), flags, &nfs_write_ops, data);
-       rpc_call_setup(task, &msg, 0);
+       rpc_call_setup(&data->task, &msg, 0);
 }
 
 static void
@@ -705,7 +684,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,
@@ -735,7 +714,9 @@ struct nfs_rpc_ops  nfs_v2_clientops = {
        .pathconf       = nfs_proc_pathconf,
        .decode_dirent  = nfs_decode_dirent,
        .read_setup     = nfs_proc_read_setup,
+       .read_done      = nfs_read_done,
        .write_setup    = nfs_proc_write_setup,
+       .write_done     = nfs_write_done,
        .commit_setup   = nfs_proc_commit_setup,
        .file_open      = nfs_open,
        .file_release   = nfs_release,