@@ -86,7 +86,7 @@ static enum nfsstat4 exofs_layout_get(
struct pnfs_osd_layout layout;
__be32 *start;
bool in_recall;
- int i, err;
+ int i;
enum nfsstat4 nfserr;
res->lg_seg.offset = 0;
@@ -107,11 +107,9 @@ static enum nfsstat4 exofs_layout_get(
layout.olo_num_comps = el->s_numdevs;
layout.olo_comps = creds;
- err = pnfs_osd_xdr_encode_layout_hdr(xdr, &layout);
- if (err) {
- nfserr = NFS4ERR_TOOSMALL;
+ nfserr = pnfs_osd_xdr_encode_layout_hdr(xdr, &layout);
+ if (unlikely(nfserr))
goto out;
- }
/* Encode layout components */
for (i = 0; i < el->s_numdevs; i++) {
@@ -133,11 +131,9 @@ static enum nfsstat4 exofs_layout_get(
cred.oc_cap.cred_len = OSD_CAP_LEN;
cred.oc_cap.cred = oi->i_cred;
- err = pnfs_osd_xdr_encode_layout_cred(xdr, &cred);
- if (err) {
- nfserr = NFS4ERR_TOOSMALL;
+ nfserr = pnfs_osd_xdr_encode_layout_cred(xdr, &cred);
+ if (unlikely(nfserr))
goto out;
- }
}
exp_xdr_encode_opaque_len(start, xdr->p);
@@ -303,13 +299,15 @@ int exofs_get_device_info(struct super_block *sb, struct exp_xdr_stream *xdr,
/* skip opaque size, will be filled-in later */
start = exp_xdr_reserve_qwords(xdr, 1);
if (!start) {
- err = -E2BIG;
+ err = -ETOOSMALL;
goto err;
}
err = pnfs_osd_xdr_encode_deviceaddr(xdr, &devaddr);
- if (err)
+ if (err) {
+ err = -ETOOSMALL;
goto err;
+ }
exp_xdr_encode_opaque_len(start, xdr->p);
Remove error translation from export.c, now that XDR API returns the proper constants Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> --- fs/exofs/export.c | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-)