Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+10 -10
+3 -3
fs/nfsd/nfs4layouts.c
··· 515 515 if (!list_empty(&ls->ls_layouts)) { 516 516 if (found) 517 517 nfs4_inc_and_copy_stateid(&lrp->lr_sid, &ls->ls_stid); 518 - lrp->lrs_present = 1; 518 + lrp->lrs_present = true; 519 519 } else { 520 520 trace_nfsd_layoutstate_unhash(&ls->ls_stid.sc_stateid); 521 521 nfs4_unhash_stid(&ls->ls_stid); 522 - lrp->lrs_present = 0; 522 + lrp->lrs_present = false; 523 523 } 524 524 spin_unlock(&ls->ls_lock); 525 525 ··· 539 539 struct nfs4_layout *lp, *t; 540 540 LIST_HEAD(reaplist); 541 541 542 - lrp->lrs_present = 0; 542 + lrp->lrs_present = false; 543 543 544 544 spin_lock(&clp->cl_lock); 545 545 list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt) {
+6 -6
fs/nfsd/nfs4xdr.c
··· 4931 4931 { 4932 4932 struct nfsd4_layoutreturn *lrp = &u->layoutreturn; 4933 4933 struct xdr_stream *xdr = resp->xdr; 4934 - __be32 *p; 4935 4934 4936 - p = xdr_reserve_space(xdr, 4); 4937 - if (!p) 4938 - return nfserr_resource; 4939 - *p++ = cpu_to_be32(lrp->lrs_present); 4935 + /* lrs_present */ 4936 + nfserr = nfsd4_encode_bool(xdr, lrp->lrs_present); 4937 + if (nfserr != nfs_ok) 4938 + return nfserr; 4940 4939 if (lrp->lrs_present) 4940 + /* lrs_stateid */ 4941 4941 return nfsd4_encode_stateid4(xdr, &lrp->lr_sid); 4942 - return 0; 4942 + return nfs_ok; 4943 4943 } 4944 4944 #endif /* CONFIG_NFSD_PNFS */ 4945 4945
+1 -1
fs/nfsd/xdr4.h
··· 630 630 u32 lrf_body_len; /* request */ 631 631 void *lrf_body; /* request */ 632 632 stateid_t lr_sid; /* request/response */ 633 - u32 lrs_present; /* response */ 633 + bool lrs_present; /* response */ 634 634 }; 635 635 636 636 struct nfsd4_fallocate {