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] = { ...@@ -116,27 +116,6 @@ u32 nfs4_pathconf_bitmap[2] = {
0 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 static void
nfs4_setup_putfh(struct nfs4_compound *cp, struct nfs_fh *fhandle) 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) ...@@ -220,18 +199,6 @@ nfs4_setup_readlink(struct nfs4_compound *cp, int count, struct page **pages)
cp->req_nops++; 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 static void
renew_lease(struct nfs_server *server, unsigned long timestamp) renew_lease(struct nfs_server *server, unsigned long timestamp)
{ {
...@@ -1100,46 +1067,38 @@ static int nfs4_proc_remove(struct inode *dir, struct qstr *name) ...@@ -1100,46 +1067,38 @@ static int nfs4_proc_remove(struct inode *dir, struct qstr *name)
} }
struct unlink_desc { struct unlink_desc {
struct nfs4_compound compound; struct nfs4_remove_arg args;
struct nfs4_op ops[3]; struct nfs4_change_info res;
struct nfs4_change_info cinfo;
struct nfs_fattr attrs;
}; };
static int static int nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir,
nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name) struct qstr *name)
{ {
struct unlink_desc * up; struct unlink_desc *up;
struct nfs4_compound * cp;
up = (struct unlink_desc *) kmalloc(sizeof(*up), GFP_KERNEL); up = (struct unlink_desc *) kmalloc(sizeof(*up), GFP_KERNEL);
if (!up) if (!up)
return -ENOMEM; return -ENOMEM;
cp = &up->compound;
nfs4_setup_compound(cp, up->ops, NFS_SERVER(dir->d_inode), "unlink_setup"); up->args.fh = NFS_FH(dir->d_inode);
nfs4_setup_putfh(cp, NFS_FH(dir->d_inode)); up->args.name = name;
nfs4_setup_remove(cp, name, &up->cinfo);
nfs4_setup_getattr(cp, &up->attrs);
msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMPOUND]; msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE];
msg->rpc_argp = cp; msg->rpc_argp = &up->args;
msg->rpc_resp = cp; msg->rpc_resp = &up->res;
return 0; return 0;
} }
static int static int nfs4_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
nfs4_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
{ {
struct rpc_message *msg = &task->tk_msg; struct rpc_message *msg = &task->tk_msg;
struct unlink_desc *up; struct unlink_desc *up;
if (msg->rpc_argp) { if (msg->rpc_resp != NULL) {
up = (struct unlink_desc *) msg->rpc_argp; up = container_of(msg->rpc_resp, struct unlink_desc, res);
process_lease(&up->compound); update_changeattr(dir->d_inode, &up->res);
process_cinfo(&up->cinfo, &up->attrs);
nfs_refresh_inode(dir->d_inode, &up->attrs);
kfree(up); kfree(up);
msg->rpc_resp = NULL;
msg->rpc_argp = NULL; msg->rpc_argp = NULL;
} }
return 0; return 0;
......
...@@ -1138,9 +1138,6 @@ encode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs ...@@ -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++) { for (i = 0; i < cp->req_nops; i++) {
switch (cp->ops[i].opnum) { switch (cp->ops[i].opnum) {
case OP_GETATTR:
status = encode_getattr(xdr, &cp->ops[i].u.getattr);
break;
case OP_PUTFH: case OP_PUTFH:
status = encode_putfh(xdr, cp->ops[i].u.putfh.pf_fhandle); status = encode_putfh(xdr, cp->ops[i].u.putfh.pf_fhandle);
break; break;
...@@ -1150,9 +1147,6 @@ encode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs ...@@ -1150,9 +1147,6 @@ encode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs
case OP_READLINK: case OP_READLINK:
status = encode_readlink(xdr, &cp->ops[i].u.readlink, req); status = encode_readlink(xdr, &cp->ops[i].u.readlink, req);
break; break;
case OP_REMOVE:
status = encode_remove(xdr, cp->ops[i].u.remove.name);
break;
default: default:
BUG(); BUG();
} }
...@@ -3220,9 +3214,6 @@ decode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs ...@@ -3220,9 +3214,6 @@ decode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs
op = &cp->ops[0]; op = &cp->ops[0];
for (cp->nops = 0; cp->nops < cp->resp_nops; cp->nops++, op++) { for (cp->nops = 0; cp->nops < cp->resp_nops; cp->nops++, op++) {
switch (op->opnum) { switch (op->opnum) {
case OP_GETATTR:
status = decode_getattr(xdr, &op->u.getattr, cp->server);
break;
case OP_PUTFH: case OP_PUTFH:
status = decode_putfh(xdr); status = decode_putfh(xdr);
break; break;
...@@ -3232,9 +3223,6 @@ decode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs ...@@ -3232,9 +3223,6 @@ decode_compound(struct xdr_stream *xdr, struct nfs4_compound *cp, struct rpc_rqs
case OP_READLINK: case OP_READLINK:
status = decode_readlink(xdr, req, &op->u.readlink); status = decode_readlink(xdr, req, &op->u.readlink);
break; break;
case OP_REMOVE:
status = decode_remove(xdr, op->u.remove.rm_cinfo);
break;
default: default:
BUG(); BUG();
return -EIO; return -EIO;
......
...@@ -613,11 +613,6 @@ struct nfs4_readlink { ...@@ -613,11 +613,6 @@ struct nfs4_readlink {
struct page ** rl_pages; /* zero-copy data */ 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 { struct nfs4_remove_arg {
const struct nfs_fh * fh; const struct nfs_fh * fh;
const struct qstr * name; const struct qstr * name;
...@@ -659,13 +654,11 @@ struct nfs4_op { ...@@ -659,13 +654,11 @@ struct nfs4_op {
u32 opnum; u32 opnum;
union { union {
struct nfs4_close close; struct nfs4_close close;
struct nfs4_getattr getattr;
struct nfs4_open open; struct nfs4_open open;
struct nfs4_open_confirm open_confirm; struct nfs4_open_confirm open_confirm;
struct nfs4_putfh putfh; struct nfs4_putfh putfh;
struct nfs4_readdir readdir; struct nfs4_readdir readdir;
struct nfs4_readlink readlink; struct nfs4_readlink readlink;
struct nfs4_remove remove;
struct nfs4_client * renew; struct nfs4_client * renew;
struct nfs4_setattr setattr; struct nfs4_setattr setattr;
} u; } 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