Commit ea6cacaf authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: assorted code readability cleanups in the XDR

parent 829186b7
...@@ -169,19 +169,6 @@ renew_lease(struct nfs_server *server, unsigned long timestamp) ...@@ -169,19 +169,6 @@ renew_lease(struct nfs_server *server, unsigned long timestamp)
spin_unlock(&clp->cl_lock); spin_unlock(&clp->cl_lock);
} }
static inline void
process_cinfo(struct nfs4_change_info *info, struct nfs_fattr *fattr)
{
BUG_ON((fattr->valid & NFS_ATTR_FATTR) == 0);
BUG_ON((fattr->valid & NFS_ATTR_FATTR_V4) == 0);
if (fattr->change_attr == info->after) {
fattr->pre_change_attr = info->before;
fattr->valid |= NFS_ATTR_PRE_CHANGE;
fattr->timestamp = jiffies;
}
}
static void update_changeattr(struct inode *inode, struct nfs4_change_info *cinfo) static void update_changeattr(struct inode *inode, struct nfs4_change_info *cinfo)
{ {
struct nfs_inode *nfsi = NFS_I(inode); struct nfs_inode *nfsi = NFS_I(inode);
...@@ -203,12 +190,6 @@ nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state) ...@@ -203,12 +190,6 @@ nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state)
struct nfs_fattr fattr = { struct nfs_fattr fattr = {
.valid = 0, .valid = 0,
}; };
struct nfs4_change_info d_cinfo;
struct nfs4_getattr f_getattr = {
.gt_bmval = nfs4_fattr_bitmap,
.gt_attrs = &fattr,
};
struct nfs_open_reclaimargs o_arg = { struct nfs_open_reclaimargs o_arg = {
.fh = NFS_FH(inode), .fh = NFS_FH(inode),
.seqid = sp->so_seqid, .seqid = sp->so_seqid,
...@@ -216,11 +197,10 @@ nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state) ...@@ -216,11 +197,10 @@ nfs4_open_reclaim(struct nfs4_state_owner *sp, struct nfs4_state *state)
.share_access = state->state, .share_access = state->state,
.clientid = server->nfs4_state->cl_clientid, .clientid = server->nfs4_state->cl_clientid,
.claim = NFS4_OPEN_CLAIM_PREVIOUS, .claim = NFS4_OPEN_CLAIM_PREVIOUS,
.f_getattr = &f_getattr, .bitmask = nfs4_fattr_bitmap,
}; };
struct nfs_openres o_res = { struct nfs_openres o_res = {
.cinfo = &d_cinfo, .f_attr = &fattr,
.f_getattr = &f_getattr,
.server = server, /* Grrr */ .server = server, /* Grrr */
}; };
struct rpc_message msg = { struct rpc_message msg = {
...@@ -250,36 +230,21 @@ nfs4_do_open(struct inode *dir, struct qstr *name, int flags, struct iattr *satt ...@@ -250,36 +230,21 @@ nfs4_do_open(struct inode *dir, struct qstr *name, int flags, struct iattr *satt
struct nfs4_state *state = NULL; struct nfs4_state *state = NULL;
struct nfs_server *server = NFS_SERVER(dir); struct nfs_server *server = NFS_SERVER(dir);
struct inode *inode = NULL; struct inode *inode = NULL;
struct nfs4_change_info d_cinfo;
int status; int status;
struct nfs_fattr d_attr = {
.valid = 0,
};
struct nfs_fattr f_attr = { struct nfs_fattr f_attr = {
.valid = 0, .valid = 0,
}; };
struct nfs4_getattr f_getattr = {
.gt_bmval = nfs4_fattr_bitmap,
.gt_attrs = &f_attr,
};
struct nfs4_getattr d_getattr = {
.gt_bmval = nfs4_fattr_bitmap,
.gt_attrs = &d_attr,
};
struct nfs_openargs o_arg = { struct nfs_openargs o_arg = {
.fh = NFS_FH(dir), .fh = NFS_FH(dir),
.share_access = flags & (FMODE_READ|FMODE_WRITE), .share_access = flags & (FMODE_READ|FMODE_WRITE),
.opentype = (flags & O_CREAT) ? NFS4_OPEN_CREATE : NFS4_OPEN_NOCREATE, .opentype = (flags & O_CREAT) ? NFS4_OPEN_CREATE : NFS4_OPEN_NOCREATE,
.createmode = (flags & O_EXCL) ? NFS4_CREATE_EXCLUSIVE : NFS4_CREATE_UNCHECKED, .createmode = (flags & O_EXCL) ? NFS4_CREATE_EXCLUSIVE : NFS4_CREATE_UNCHECKED,
.name = name, .name = name,
.f_getattr = &f_getattr,
.d_getattr = &d_getattr,
.server = server, .server = server,
.bitmask = nfs4_fattr_bitmap,
}; };
struct nfs_openres o_res = { struct nfs_openres o_res = {
.cinfo = &d_cinfo, .f_attr = &f_attr,
.f_getattr = &f_getattr,
.d_getattr = &d_getattr,
.server = server, .server = server,
}; };
struct rpc_message msg = { struct rpc_message msg = {
...@@ -312,8 +277,7 @@ nfs4_do_open(struct inode *dir, struct qstr *name, int flags, struct iattr *satt ...@@ -312,8 +277,7 @@ nfs4_do_open(struct inode *dir, struct qstr *name, int flags, struct iattr *satt
nfs4_increment_seqid(status, sp); nfs4_increment_seqid(status, sp);
if (status) if (status)
goto out_up; goto out_up;
process_cinfo(&d_cinfo, &d_attr); update_changeattr(dir, &o_res.cinfo);
nfs_refresh_inode(dir, &d_attr);
status = -ENOMEM; status = -ENOMEM;
inode = nfs_fhget(dir->i_sb, &o_res.fh, &f_attr); inode = nfs_fhget(dir->i_sb, &o_res.fh, &f_attr);
...@@ -395,18 +359,14 @@ nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr, ...@@ -395,18 +359,14 @@ nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr,
struct nfs_fh *fhandle, struct iattr *sattr, struct nfs_fh *fhandle, struct iattr *sattr,
struct nfs4_state *state) struct nfs4_state *state)
{ {
struct nfs4_getattr getattr = {
.gt_bmval = nfs4_fattr_bitmap,
.gt_attrs = fattr,
};
struct nfs_setattrargs arg = { struct nfs_setattrargs arg = {
.fh = fhandle, .fh = fhandle,
.iap = sattr, .iap = sattr,
.attr = &getattr,
.server = server, .server = server,
.bitmask = nfs4_fattr_bitmap,
}; };
struct nfs_setattrres res = { struct nfs_setattrres res = {
.attr = &getattr, .fattr = fattr,
.server = server, .server = server,
}; };
struct rpc_message msg = { struct rpc_message msg = {
......
This diff is collapsed.
...@@ -89,6 +89,12 @@ struct nfs_pathconf { ...@@ -89,6 +89,12 @@ struct nfs_pathconf {
__u32 max_namelen; /* max name length */ __u32 max_namelen; /* max name length */
}; };
struct nfs4_change_info {
u32 atomic;
u64 before;
u64 after;
};
/* /*
* Arguments to the open call. * Arguments to the open call.
*/ */
...@@ -104,20 +110,18 @@ struct nfs_openargs { ...@@ -104,20 +110,18 @@ struct nfs_openargs {
struct iattr * attrs; /* UNCHECKED, GUARDED */ struct iattr * attrs; /* UNCHECKED, GUARDED */
nfs4_verifier verifier; /* EXCLUSIVE */ nfs4_verifier verifier; /* EXCLUSIVE */
} u; } u;
struct qstr * name; const struct qstr * name;
struct nfs4_getattr * f_getattr; const struct nfs_server *server; /* Needed for ID mapping */
struct nfs4_getattr * d_getattr; const u32 * bitmask;
struct nfs_server * server; /* Needed for ID mapping */
}; };
struct nfs_openres { struct nfs_openres {
nfs4_stateid stateid; nfs4_stateid stateid;
struct nfs_fh fh; struct nfs_fh fh;
struct nfs4_change_info * cinfo; struct nfs4_change_info cinfo;
__u32 rflags; __u32 rflags;
struct nfs4_getattr * f_getattr; struct nfs_fattr * f_attr;
struct nfs4_getattr * d_getattr; const struct nfs_server *server;
struct nfs_server * server;
}; };
/* /*
...@@ -143,7 +147,7 @@ struct nfs_open_reclaimargs { ...@@ -143,7 +147,7 @@ struct nfs_open_reclaimargs {
__u32 id; __u32 id;
__u32 share_access; __u32 share_access;
__u32 claim; __u32 claim;
struct nfs4_getattr * f_getattr; const __u32 * bitmask;
}; };
/* /*
...@@ -217,7 +221,7 @@ struct nfs_lockres { ...@@ -217,7 +221,7 @@ struct nfs_lockres {
nfs4_stateid stateid;/* LOCK success, LOCKU */ nfs4_stateid stateid;/* LOCK success, LOCKU */
struct nfs_lock_denied denied; /* LOCK failed, LOCKT success */ struct nfs_lock_denied denied; /* LOCK failed, LOCKT success */
} u; } u;
struct nfs_server * server; const struct nfs_server * server;
}; };
/* /*
...@@ -323,13 +327,13 @@ struct nfs_setattrargs { ...@@ -323,13 +327,13 @@ struct nfs_setattrargs {
struct nfs_fh * fh; struct nfs_fh * fh;
nfs4_stateid stateid; nfs4_stateid stateid;
struct iattr * iap; struct iattr * iap;
struct nfs4_getattr * attr; const struct nfs_server * server; /* Needed for name mapping */
struct nfs_server * server; /* Needed for name mapping */ const u32 * bitmask;
}; };
struct nfs_setattrres { struct nfs_setattrres {
struct nfs4_getattr * attr; struct nfs_fattr * fattr;
struct nfs_server * server; const struct nfs_server * server;
}; };
struct nfs_linkargs { struct nfs_linkargs {
...@@ -480,12 +484,6 @@ struct nfs3_readdirres { ...@@ -480,12 +484,6 @@ struct nfs3_readdirres {
typedef u64 clientid4; typedef u64 clientid4;
struct nfs4_change_info {
u32 atomic;
u64 before;
u64 after;
};
struct nfs4_accessargs { struct nfs4_accessargs {
const struct nfs_fh * fh; const struct nfs_fh * fh;
u32 access; u32 access;
...@@ -519,12 +517,6 @@ struct nfs4_create_res { ...@@ -519,12 +517,6 @@ struct nfs4_create_res {
struct nfs4_change_info dir_cinfo; struct nfs4_change_info dir_cinfo;
}; };
struct nfs4_getattr {
u32 * gt_bmval; /* request */
struct nfs_fattr * gt_attrs; /* response */
struct nfs_fsstat * gt_fsstat; /* response */
};
struct nfs4_getattr_arg { struct nfs4_getattr_arg {
const struct nfs_fh * fh; const struct nfs_fh * fh;
const u32 * bitmask; const u32 * bitmask;
......
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