Commit cde2c5bc authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] knfsd: nfsd4: encode_dirent: simplify control flow

Replace series of if's by a switch, remove (now unnecessary) label "out".
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bdc337cc
......@@ -1854,15 +1854,14 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
* Now we come to the ugly part: writing the fattr for this entry.
*/
nfserr = nfsd4_encode_dirent_fattr(cd, name, namlen, p, &buflen);
if (!nfserr) {
switch (nfserr) {
case nfs_ok:
p += buflen;
goto out;
}
if (nfserr == nfserr_resource) {
break;
case nfserr_resource:
nfserr = nfserr_toosmall;
goto fail;
}
default:
/*
* If we get here, we experienced a miscellaneous
* failure while writing the attributes. If the
......@@ -1878,8 +1877,8 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
p = nfsd4_encode_rdattr_error(p, buflen, nfserr);
if (p == NULL)
goto fail;
}
out:
cd->buflen -= (p - cd->buffer);
cd->buffer = p;
cd->common.err = nfs_ok;
......
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