提交 c79d56d2 编写于 作者: A Anna Schumaker 提交者: Trond Myklebust

NFS: Clean up decode_layoutrecall_args()

Additionally, this change lets us cut out the goto by returning errors
immediately.
Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
上级 135a4ea0
...@@ -227,10 +227,8 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp, ...@@ -227,10 +227,8 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
uint32_t iomode; uint32_t iomode;
p = read_buf(xdr, 4 * sizeof(uint32_t)); p = read_buf(xdr, 4 * sizeof(uint32_t));
if (unlikely(p == NULL)) { if (unlikely(p == NULL))
status = htonl(NFS4ERR_BADXDR); return htonl(NFS4ERR_BADXDR);
goto out;
}
args->cbl_layout_type = ntohl(*p++); args->cbl_layout_type = ntohl(*p++);
/* Depite the spec's xdr, iomode really belongs in the FILE switch, /* Depite the spec's xdr, iomode really belongs in the FILE switch,
...@@ -244,37 +242,23 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp, ...@@ -244,37 +242,23 @@ static __be32 decode_layoutrecall_args(struct svc_rqst *rqstp,
args->cbl_range.iomode = iomode; args->cbl_range.iomode = iomode;
status = decode_fh(xdr, &args->cbl_fh); status = decode_fh(xdr, &args->cbl_fh);
if (unlikely(status != 0)) if (unlikely(status != 0))
goto out; return status;
p = read_buf(xdr, 2 * sizeof(uint64_t)); p = read_buf(xdr, 2 * sizeof(uint64_t));
if (unlikely(p == NULL)) { if (unlikely(p == NULL))
status = htonl(NFS4ERR_BADXDR); return htonl(NFS4ERR_BADXDR);
goto out;
}
p = xdr_decode_hyper(p, &args->cbl_range.offset); p = xdr_decode_hyper(p, &args->cbl_range.offset);
p = xdr_decode_hyper(p, &args->cbl_range.length); p = xdr_decode_hyper(p, &args->cbl_range.length);
status = decode_layout_stateid(xdr, &args->cbl_stateid); return decode_layout_stateid(xdr, &args->cbl_stateid);
if (unlikely(status != 0))
goto out;
} else if (args->cbl_recall_type == RETURN_FSID) { } else if (args->cbl_recall_type == RETURN_FSID) {
p = read_buf(xdr, 2 * sizeof(uint64_t)); p = read_buf(xdr, 2 * sizeof(uint64_t));
if (unlikely(p == NULL)) { if (unlikely(p == NULL))
status = htonl(NFS4ERR_BADXDR); return htonl(NFS4ERR_BADXDR);
goto out;
}
p = xdr_decode_hyper(p, &args->cbl_fsid.major); p = xdr_decode_hyper(p, &args->cbl_fsid.major);
p = xdr_decode_hyper(p, &args->cbl_fsid.minor); p = xdr_decode_hyper(p, &args->cbl_fsid.minor);
} else if (args->cbl_recall_type != RETURN_ALL) { } else if (args->cbl_recall_type != RETURN_ALL)
status = htonl(NFS4ERR_BADXDR); return htonl(NFS4ERR_BADXDR);
goto out; return 0;
}
dprintk("%s: ltype 0x%x iomode %d changed %d recall_type %d\n",
__func__,
args->cbl_layout_type, iomode,
args->cbl_layoutchanged, args->cbl_recall_type);
out:
dprintk("%s: exit with status = %d\n", __func__, ntohl(status));
return status;
} }
static static
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册