Commit 85ac427f authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: use the (more efficient) NFSv2/v3-like XDR scheme for generating

GETATTR RPC calls.
parent 9c0c8d90
...@@ -876,18 +876,25 @@ nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle, ...@@ -876,18 +876,25 @@ nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
return nfs4_proc_fsinfo(server, fhandle, info); return nfs4_proc_fsinfo(server, fhandle, info);
} }
static int static int nfs4_proc_getattr(struct inode *inode, struct nfs_fattr *fattr)
nfs4_proc_getattr(struct inode *inode, struct nfs_fattr *fattr)
{ {
struct nfs4_compound compound; struct nfs4_getattr_arg args = {
struct nfs4_op ops[2]; .fh = NFS_FH(inode),
.bitmask = nfs4_fattr_bitmap,
};
struct nfs4_getattr_res res = {
.fattr = fattr,
.server = NFS_SERVER(inode),
};
struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETATTR],
.rpc_argp = &args,
.rpc_resp = &res,
};
fattr->valid = 0; fattr->valid = 0;
nfs4_setup_compound(&compound, ops, NFS_SERVER(inode), "getattr"); return nfs4_map_errors(rpc_call_sync(NFS_CLIENT(inode), &msg, 0));
nfs4_setup_putfh(&compound, NFS_FH(inode));
nfs4_setup_getattr(&compound, fattr);
return nfs4_map_errors(nfs4_call_compound(&compound, NULL, 0));
} }
/* /*
......
This diff is collapsed.
...@@ -304,6 +304,7 @@ enum { ...@@ -304,6 +304,7 @@ enum {
NFSPROC4_CLNT_LOCKT, NFSPROC4_CLNT_LOCKT,
NFSPROC4_CLNT_LOCKU, NFSPROC4_CLNT_LOCKU,
NFSPROC4_CLNT_ACCESS, NFSPROC4_CLNT_ACCESS,
NFSPROC4_CLNT_GETATTR,
}; };
#endif #endif
......
...@@ -3,6 +3,11 @@ ...@@ -3,6 +3,11 @@
#include <linux/sunrpc/xprt.h> #include <linux/sunrpc/xprt.h>
struct nfs4_fsid {
__u64 major;
__u64 minor;
};
struct nfs_fattr { struct nfs_fattr {
unsigned short valid; /* which fields are valid */ unsigned short valid; /* which fields are valid */
__u64 pre_size; /* pre_op_attr.size */ __u64 pre_size; /* pre_op_attr.size */
...@@ -26,10 +31,7 @@ struct nfs_fattr { ...@@ -26,10 +31,7 @@ struct nfs_fattr {
dev_t rdev; dev_t rdev;
union { union {
__u64 nfs3; /* also nfs2 */ __u64 nfs3; /* also nfs2 */
struct { struct nfs4_fsid nfs4;
__u64 major;
__u64 minor;
} nfs4;
} fsid_u; } fsid_u;
__u64 fileid; __u64 fileid;
struct timespec atime; struct timespec atime;
...@@ -528,6 +530,16 @@ struct nfs4_getattr { ...@@ -528,6 +530,16 @@ struct nfs4_getattr {
struct nfs_pathconf * gt_pathconf; /* response */ struct nfs_pathconf * gt_pathconf; /* response */
}; };
struct nfs4_getattr_arg {
const struct nfs_fh * fh;
const u32 * bitmask;
};
struct nfs4_getattr_res {
const struct nfs_server * server;
struct nfs_fattr * fattr;
};
struct nfs4_getfh { struct nfs4_getfh {
struct nfs_fh * gf_fhandle; /* response */ struct nfs_fh * gf_fhandle; /* response */
}; };
......
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