Commit 15c5fef5 authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: use the (more efficient) NFSv2/v3-like XDR scheme when doing

sillyrename() completion.
parent 33abaafc
......@@ -116,27 +116,6 @@ u32 nfs4_pathconf_bitmap[2] = {
0
};
static inline void
__nfs4_setup_getattr(struct nfs4_compound *cp, u32 *bitmap,
struct nfs_fattr *fattr)
{
struct nfs4_getattr *getattr = GET_OP(cp, getattr);
getattr->gt_bmval = bitmap;
getattr->gt_attrs = fattr;
getattr->gt_fsstat = NULL;
OPNUM(cp) = OP_GETATTR;
cp->req_nops++;
}
static void
nfs4_setup_getattr(struct nfs4_compound *cp,
struct nfs_fattr *fattr)
{
__nfs4_setup_getattr(cp, nfs4_fattr_bitmap, fattr);
}
static void
nfs4_setup_putfh(struct nfs4_compound *cp, struct nfs_fh *fhandle)
{
......@@ -220,18 +199,6 @@ nfs4_setup_readlink(struct nfs4_compound *cp, int count, struct page **pages)
cp->req_nops++;
}
static void
nfs4_setup_remove(struct nfs4_compound *cp, struct qstr *name, struct nfs4_change_info *cinfo)
{
struct nfs4_remove *remove = GET_OP(cp, remove);
remove->name = name;
remove->rm_cinfo = cinfo;
OPNUM(cp) = OP_REMOVE;
cp->req_nops++;
}
static void
renew_lease(struct nfs_server *server, unsigned long timestamp)
{
......@@ -1100,46 +1067,38 @@ static int nfs4_proc_remove(struct inode *dir, struct qstr *name)
}
struct unlink_desc {
struct nfs4_compound compound;
struct nfs4_op ops[3];
struct nfs4_change_info cinfo;
struct nfs_fattr attrs;
struct nfs4_remove_arg args;
struct nfs4_change_info res;
};
static int
nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name)
static int nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir,
struct qstr *name)
{
struct unlink_desc * up;
struct nfs4_compound * cp;
struct unlink_desc *up;
up = (struct unlink_desc *) kmalloc(sizeof(*up), GFP_KERNEL);
if (!up)
return -ENOMEM;
cp = &up->compound;
nfs4_setup_compound(cp, up->ops, NFS_SERVER(dir->d_inode), "unlink_setup");
nfs4_setup_putfh(cp, NFS_FH(dir->d_inode));
nfs4_setup_remove(cp, name, &up->cinfo);
nfs4_setup_getattr(cp, &up->attrs);
up->args.fh = NFS_FH(dir->d_inode);
up->args.name = name;
msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMPOUND];
msg->rpc_argp = cp;
msg->rpc_resp = cp;
msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE];
msg->rpc_argp = &up->args;
msg->rpc_resp = &up->res;
return 0;
}
static int
nfs4_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
static int nfs4_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
{
struct rpc_message *msg = &task->tk_msg;
struct unlink_desc *up;
if (msg->rpc_argp) {
up = (struct unlink_desc *) msg->rpc_argp;
process_lease(&up->compound);
process_cinfo(&up->cinfo, &up->attrs);
nfs_refresh_inode(dir->d_inode, &up->attrs);
if (msg->rpc_resp != NULL) {
up = container_of(msg->rpc_resp, struct unlink_desc, res);
update_changeattr(dir->d_inode, &up->res);
kfree(up);
msg->rpc_resp = NULL;
msg->rpc_argp = NULL;
}
return 0;
......
......@@ -1138,9 +1138,6 @@ encode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs
for (i = 0; i < cp->req_nops; i++) {
switch (cp->ops[i].opnum) {
case OP_GETATTR:
status = encode_getattr(xdr, &cp->ops[i].u.getattr);
break;
case OP_PUTFH:
status = encode_putfh(xdr, cp->ops[i].u.putfh.pf_fhandle);
break;
......@@ -1150,9 +1147,6 @@ encode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs
case OP_READLINK:
status = encode_readlink(xdr, &cp->ops[i].u.readlink, req);
break;
case OP_REMOVE:
status = encode_remove(xdr, cp->ops[i].u.remove.name);
break;
default:
BUG();
}
......@@ -3220,9 +3214,6 @@ decode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs
op = &cp->ops[0];
for (cp->nops = 0; cp->nops < cp->resp_nops; cp->nops++, op++) {
switch (op->opnum) {
case OP_GETATTR:
status = decode_getattr(xdr, &op->u.getattr, cp->server);
break;
case OP_PUTFH:
status = decode_putfh(xdr);
break;
......@@ -3232,9 +3223,6 @@ decode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs
case OP_READLINK:
status = decode_readlink(xdr, req, &op->u.readlink);
break;
case OP_REMOVE:
status = decode_remove(xdr, op->u.remove.rm_cinfo);
break;
default:
BUG();
return -EIO;
......
......@@ -613,11 +613,6 @@ struct nfs4_readlink {
struct page ** rl_pages; /* zero-copy data */
};
struct nfs4_remove {
struct qstr * name; /* request */
struct nfs4_change_info * rm_cinfo; /* response */
};
struct nfs4_remove_arg {
const struct nfs_fh * fh;
const struct qstr * name;
......@@ -659,13 +654,11 @@ struct nfs4_op {
u32 opnum;
union {
struct nfs4_close close;
struct nfs4_getattr getattr;
struct nfs4_open open;
struct nfs4_open_confirm open_confirm;
struct nfs4_putfh putfh;
struct nfs4_readdir readdir;
struct nfs4_readlink readlink;
struct nfs4_remove remove;
struct nfs4_client * renew;
struct nfs4_setattr setattr;
} u;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment