]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/nfs/unlink.c
NFS: remove a no-longer-needed error check in nfs_symlink()
[linux-2.6-omap-h63xx.git] / fs / nfs / unlink.c
index d639d172d568fac861124a4e43c8d8f946741438..0e28189c2151d42e55ddc76abb5abe7d3948b06f 100644 (file)
@@ -87,10 +87,9 @@ nfs_copy_dname(struct dentry *dentry, struct nfs_unlinkdata *data)
  * We delay initializing RPC info until after the call to dentry_iput()
  * in order to minimize races against rename().
  */
-static void
-nfs_async_unlink_init(struct rpc_task *task)
+static void nfs_async_unlink_init(struct rpc_task *task, void *calldata)
 {
-       struct nfs_unlinkdata   *data = (struct nfs_unlinkdata *)task->tk_calldata;
+       struct nfs_unlinkdata   *data = calldata;
        struct dentry           *dir = data->dir;
        struct rpc_message      msg = {
                .rpc_cred       = data->cred,
@@ -116,10 +115,9 @@ nfs_async_unlink_init(struct rpc_task *task)
  *
  * Do the directory attribute update.
  */
-static void
-nfs_async_unlink_done(struct rpc_task *task)
+static void nfs_async_unlink_done(struct rpc_task *task, void *calldata)
 {
-       struct nfs_unlinkdata   *data = (struct nfs_unlinkdata *)task->tk_calldata;
+       struct nfs_unlinkdata   *data = calldata;
        struct dentry           *dir = data->dir;
        struct inode            *dir_i;
 
@@ -141,13 +139,18 @@ nfs_async_unlink_done(struct rpc_task *task)
  * We need to call nfs_put_unlinkdata as a 'tk_release' task since the
  * rpc_task would be freed too.
  */
-static void
-nfs_async_unlink_release(struct rpc_task *task)
+static void nfs_async_unlink_release(void *calldata)
 {
-       struct nfs_unlinkdata   *data = (struct nfs_unlinkdata *)task->tk_calldata;
+       struct nfs_unlinkdata   *data = calldata;
        nfs_put_unlinkdata(data);
 }
 
+static const struct rpc_call_ops nfs_unlink_ops = {
+       .rpc_call_prepare = nfs_async_unlink_init,
+       .rpc_call_done = nfs_async_unlink_done,
+       .rpc_release = nfs_async_unlink_release,
+};
+
 /**
  * nfs_async_unlink - asynchronous unlinking of a file
  * @dentry: dentry to unlink
@@ -157,14 +160,12 @@ nfs_async_unlink(struct dentry *dentry)
 {
        struct dentry   *dir = dentry->d_parent;
        struct nfs_unlinkdata   *data;
-       struct rpc_task *task;
        struct rpc_clnt *clnt = NFS_CLIENT(dir->d_inode);
        int             status = -ENOMEM;
 
-       data = kmalloc(sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (!data)
                goto out;
-       memset(data, 0, sizeof(*data));
 
        data->cred = rpcauth_lookupcred(clnt->cl_auth, 0);
        if (IS_ERR(data->cred)) {
@@ -178,17 +179,13 @@ nfs_async_unlink(struct dentry *dentry)
        nfs_deletes = data;
        data->count = 1;
 
-       task = &data->task;
-       rpc_init_task(task, clnt, nfs_async_unlink_done , RPC_TASK_ASYNC);
-       task->tk_calldata = data;
-       task->tk_action = nfs_async_unlink_init;
-       task->tk_release = nfs_async_unlink_release;
+       rpc_init_task(&data->task, clnt, RPC_TASK_ASYNC, &nfs_unlink_ops, data);
 
        spin_lock(&dentry->d_lock);
        dentry->d_flags |= DCACHE_NFSFS_RENAMED;
        spin_unlock(&dentry->d_lock);
 
-       rpc_sleep_on(&nfs_delete_queue, task, NULL, NULL);
+       rpc_sleep_on(&nfs_delete_queue, &data->task, NULL, NULL);
        status = 0;
  out:
        return status;