Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
[pandora-kernel.git] / fs / nfs / proc.c
index 4529cc4..845cdde 100644 (file)
@@ -43,7 +43,6 @@
 #include <linux/nfs_fs.h>
 #include <linux/nfs_page.h>
 #include <linux/lockd/bind.h>
-#include <linux/smp_lock.h>
 #include "internal.h"
 
 #define NFSDBG_FACILITY                NFSDBG_PROC
@@ -186,61 +185,6 @@ static int nfs_proc_readlink(struct inode *inode, struct page *page,
        return status;
 }
 
-static int nfs_proc_read(struct nfs_read_data *rdata)
-{
-       int                     flags = rdata->flags;
-       struct inode *          inode = rdata->inode;
-       struct nfs_fattr *      fattr = rdata->res.fattr;
-       struct rpc_message      msg = {
-               .rpc_proc       = &nfs_procedures[NFSPROC_READ],
-               .rpc_argp       = &rdata->args,
-               .rpc_resp       = &rdata->res,
-               .rpc_cred       = rdata->cred,
-       };
-       int                     status;
-
-       dprintk("NFS call  read %d @ %Ld\n", rdata->args.count,
-                       (long long) rdata->args.offset);
-       nfs_fattr_init(fattr);
-       status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
-       if (status >= 0) {
-               nfs_refresh_inode(inode, fattr);
-               /* Emulate the eof flag, which isn't normally needed in NFSv2
-                * as it is guaranteed to always return the file attributes
-                */
-               if (rdata->args.offset + rdata->args.count >= fattr->size)
-                       rdata->res.eof = 1;
-       }
-       dprintk("NFS reply read: %d\n", status);
-       return status;
-}
-
-static int nfs_proc_write(struct nfs_write_data *wdata)
-{
-       int                     flags = wdata->flags;
-       struct inode *          inode = wdata->inode;
-       struct nfs_fattr *      fattr = wdata->res.fattr;
-       struct rpc_message      msg = {
-               .rpc_proc       = &nfs_procedures[NFSPROC_WRITE],
-               .rpc_argp       = &wdata->args,
-               .rpc_resp       = &wdata->res,
-               .rpc_cred       = wdata->cred,
-       };
-       int                     status;
-
-       dprintk("NFS call  write %d @ %Ld\n", wdata->args.count,
-                       (long long) wdata->args.offset);
-       nfs_fattr_init(fattr);
-       status = rpc_call_sync(NFS_CLIENT(inode), &msg, flags);
-       if (status >= 0) {
-               nfs_post_op_update_inode(inode, fattr);
-               wdata->res.count = wdata->args.count;
-               wdata->verf.committed = NFS_FILE_SYNC;
-       }
-       dprintk("NFS reply write: %d\n", status);
-       return status < 0? status : wdata->res.count;
-}
-
 static int
 nfs_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
                int flags, struct nameidata *nd)
@@ -328,14 +272,14 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
 static int
 nfs_proc_remove(struct inode *dir, struct qstr *name)
 {
-       struct nfs_diropargs    arg = {
-               .fh             = NFS_FH(dir),
-               .name           = name->name,
-               .len            = name->len
+       struct nfs_removeargs arg = {
+               .fh = NFS_FH(dir),
+               .name.len = name->len,
+               .name.name = name->name,
        };
-       struct rpc_message      msg = { 
-               .rpc_proc       = &nfs_procedures[NFSPROC_REMOVE],
-               .rpc_argp       = &arg,
+       struct rpc_message msg = { 
+               .rpc_proc = &nfs_procedures[NFSPROC_REMOVE],
+               .rpc_argp = &arg,
        };
        int                     status;
 
@@ -347,32 +291,16 @@ nfs_proc_remove(struct inode *dir, struct qstr *name)
        return status;
 }
 
-static int
-nfs_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name)
+static void
+nfs_proc_unlink_setup(struct rpc_message *msg, struct inode *dir)
 {
-       struct nfs_diropargs    *arg;
-
-       arg = kmalloc(sizeof(*arg), GFP_KERNEL);
-       if (!arg)
-               return -ENOMEM;
-       arg->fh = NFS_FH(dir->d_inode);
-       arg->name = name->name;
-       arg->len = name->len;
        msg->rpc_proc = &nfs_procedures[NFSPROC_REMOVE];
-       msg->rpc_argp = arg;
-       return 0;
 }
 
-static int
-nfs_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
+static int nfs_proc_unlink_done(struct rpc_task *task, struct inode *dir)
 {
-       struct rpc_message *msg = &task->tk_msg;
-       
-       if (msg->rpc_argp) {
-               nfs_mark_for_revalidate(dir->d_inode);
-               kfree(msg->rpc_argp);
-       }
-       return 0;
+       nfs_mark_for_revalidate(dir);
+       return 1;
 }
 
 static int
@@ -545,13 +473,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;
 }
 
@@ -680,7 +605,7 @@ nfs_proc_commit_setup(struct nfs_write_data *data, int how)
 static int
 nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
 {
-       return nlmclnt_proc(filp->f_dentry->d_inode, cmd, fl);
+       return nlmclnt_proc(filp->f_path.dentry->d_inode, cmd, fl);
 }
 
 
@@ -695,9 +620,6 @@ const struct nfs_rpc_ops nfs_v2_clientops = {
        .lookup         = nfs_proc_lookup,
        .access         = NULL,                /* access */
        .readlink       = nfs_proc_readlink,
-       .read           = nfs_proc_read,
-       .write          = nfs_proc_write,
-       .commit         = NULL,                /* commit */
        .create         = nfs_proc_create,
        .remove         = nfs_proc_remove,
        .unlink_setup   = nfs_proc_unlink_setup,