NFSD: Clean up nfsd4_encode_layoutreturn()
Adopt the use of conventional XDR utility functions. Restructure the encoder to better align with the XDR definition of the result. Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
parent
cc313f80d0
commit
85dbc978b3
@ -515,11 +515,11 @@ nfsd4_return_file_layouts(struct svc_rqst *rqstp,
|
||||
if (!list_empty(&ls->ls_layouts)) {
|
||||
if (found)
|
||||
nfs4_inc_and_copy_stateid(&lrp->lr_sid, &ls->ls_stid);
|
||||
lrp->lrs_present = 1;
|
||||
lrp->lrs_present = true;
|
||||
} else {
|
||||
trace_nfsd_layoutstate_unhash(&ls->ls_stid.sc_stateid);
|
||||
nfs4_unhash_stid(&ls->ls_stid);
|
||||
lrp->lrs_present = 0;
|
||||
lrp->lrs_present = false;
|
||||
}
|
||||
spin_unlock(&ls->ls_lock);
|
||||
|
||||
@ -539,7 +539,7 @@ nfsd4_return_client_layouts(struct svc_rqst *rqstp,
|
||||
struct nfs4_layout *lp, *t;
|
||||
LIST_HEAD(reaplist);
|
||||
|
||||
lrp->lrs_present = 0;
|
||||
lrp->lrs_present = false;
|
||||
|
||||
spin_lock(&clp->cl_lock);
|
||||
list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt) {
|
||||
|
@ -4931,15 +4931,15 @@ nfsd4_encode_layoutreturn(struct nfsd4_compoundres *resp, __be32 nfserr,
|
||||
{
|
||||
struct nfsd4_layoutreturn *lrp = &u->layoutreturn;
|
||||
struct xdr_stream *xdr = resp->xdr;
|
||||
__be32 *p;
|
||||
|
||||
p = xdr_reserve_space(xdr, 4);
|
||||
if (!p)
|
||||
return nfserr_resource;
|
||||
*p++ = cpu_to_be32(lrp->lrs_present);
|
||||
/* lrs_present */
|
||||
nfserr = nfsd4_encode_bool(xdr, lrp->lrs_present);
|
||||
if (nfserr != nfs_ok)
|
||||
return nfserr;
|
||||
if (lrp->lrs_present)
|
||||
/* lrs_stateid */
|
||||
return nfsd4_encode_stateid4(xdr, &lrp->lr_sid);
|
||||
return 0;
|
||||
return nfs_ok;
|
||||
}
|
||||
#endif /* CONFIG_NFSD_PNFS */
|
||||
|
||||
|
@ -630,7 +630,7 @@ struct nfsd4_layoutreturn {
|
||||
u32 lrf_body_len; /* request */
|
||||
void *lrf_body; /* request */
|
||||
stateid_t lr_sid; /* request/response */
|
||||
u32 lrs_present; /* response */
|
||||
bool lrs_present; /* response */
|
||||
};
|
||||
|
||||
struct nfsd4_fallocate {
|
||||
|
Loading…
Reference in New Issue
Block a user