aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4proc.c
diff options
context:
space:
mode:
authorJ.Bruce Fields <bfields@fieldses.org>2006-12-13 03:35:39 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-13 12:05:54 -0500
commiteeac294ebd9254a937d90b00c48863e3af229047 (patch)
tree488ef0b8e4bb656423c03461ec1d4087c383c9b5 /fs/nfsd/nfs4proc.c
parentb591480bbe1a7f0e90533bce8ea86efecc84648e (diff)
[PATCH] knfsd: nfsd4: simplify migration op check
I'm not too fond of these big if conditions. Replace them by checks of a flag in the operation descriptor. To my eye this makes the code a bit more self-documenting, and makes the complicated part of the code (proc_compound) a little more compact. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd/nfs4proc.c')
-rw-r--r--fs/nfsd/nfs4proc.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index e1c463bad124..3a652e741374 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -802,6 +802,8 @@ typedef __be32(*nfsd4op_func)(struct svc_rqst *, struct nfsd4_compound_state *,
802struct nfsd4_operation { 802struct nfsd4_operation {
803 nfsd4op_func op_func; 803 nfsd4op_func op_func;
804 u32 op_flags; 804 u32 op_flags;
805/* GETATTR and ops not listed as returning NFS4ERR_MOVED: */
806#define ALLOWED_ON_ABSENT_FS 1
805}; 807};
806 808
807static struct nfsd4_operation nfsd4_ops[]; 809static struct nfsd4_operation nfsd4_ops[];
@@ -887,17 +889,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
887 op->status = nfserr_nofilehandle; 889 op->status = nfserr_nofilehandle;
888 goto encode_op; 890 goto encode_op;
889 } 891 }
890 } 892 } else if (cstate->current_fh.fh_export->ex_fslocs.migrated &&
891 /* Check must be done at start of each operation, except 893 !(opdesc->op_flags & ALLOWED_ON_ABSENT_FS)) {
892 * for GETATTR and ops not listed as returning NFS4ERR_MOVED
893 */
894 else if (cstate->current_fh.fh_export->ex_fslocs.migrated &&
895 !((op->opnum == OP_GETATTR) ||
896 (op->opnum == OP_PUTROOTFH) ||
897 (op->opnum == OP_PUTPUBFH) ||
898 (op->opnum == OP_RENEW) ||
899 (op->opnum == OP_SETCLIENTID) ||
900 (op->opnum == OP_RELEASE_LOCKOWNER))) {
901 op->status = nfserr_moved; 894 op->status = nfserr_moved;
902 goto encode_op; 895 goto encode_op;
903 } 896 }
@@ -951,6 +944,7 @@ static struct nfsd4_operation nfsd4_ops[OP_RELEASE_LOCKOWNER+1] = {
951 }, 944 },
952 [OP_GETATTR] = { 945 [OP_GETATTR] = {
953 .op_func = (nfsd4op_func)nfsd4_getattr, 946 .op_func = (nfsd4op_func)nfsd4_getattr,
947 .op_flags = ALLOWED_ON_ABSENT_FS,
954 }, 948 },
955 [OP_GETFH] = { 949 [OP_GETFH] = {
956 .op_func = (nfsd4op_func)nfsd4_getfh, 950 .op_func = (nfsd4op_func)nfsd4_getfh,
@@ -988,8 +982,13 @@ static struct nfsd4_operation nfsd4_ops[OP_RELEASE_LOCKOWNER+1] = {
988 [OP_PUTFH] = { 982 [OP_PUTFH] = {
989 .op_func = (nfsd4op_func)nfsd4_putfh, 983 .op_func = (nfsd4op_func)nfsd4_putfh,
990 }, 984 },
985 [OP_PUTPUBFH] = {
986 /* unsupported; just for future reference: */
987 .op_flags = ALLOWED_ON_ABSENT_FS,
988 },
991 [OP_PUTROOTFH] = { 989 [OP_PUTROOTFH] = {
992 .op_func = (nfsd4op_func)nfsd4_putrootfh, 990 .op_func = (nfsd4op_func)nfsd4_putrootfh,
991 .op_flags = ALLOWED_ON_ABSENT_FS,
993 }, 992 },
994 [OP_READ] = { 993 [OP_READ] = {
995 .op_func = (nfsd4op_func)nfsd4_read, 994 .op_func = (nfsd4op_func)nfsd4_read,
@@ -1008,6 +1007,7 @@ static struct nfsd4_operation nfsd4_ops[OP_RELEASE_LOCKOWNER+1] = {
1008 }, 1007 },
1009 [OP_RENEW] = { 1008 [OP_RENEW] = {
1010 .op_func = (nfsd4op_func)nfsd4_renew, 1009 .op_func = (nfsd4op_func)nfsd4_renew,
1010 .op_flags = ALLOWED_ON_ABSENT_FS,
1011 }, 1011 },
1012 [OP_RESTOREFH] = { 1012 [OP_RESTOREFH] = {
1013 .op_func = (nfsd4op_func)nfsd4_restorefh, 1013 .op_func = (nfsd4op_func)nfsd4_restorefh,
@@ -1020,6 +1020,7 @@ static struct nfsd4_operation nfsd4_ops[OP_RELEASE_LOCKOWNER+1] = {
1020 }, 1020 },
1021 [OP_SETCLIENTID] = { 1021 [OP_SETCLIENTID] = {
1022 .op_func = (nfsd4op_func)nfsd4_setclientid, 1022 .op_func = (nfsd4op_func)nfsd4_setclientid,
1023 .op_flags = ALLOWED_ON_ABSENT_FS,
1023 }, 1024 },
1024 [OP_SETCLIENTID_CONFIRM] = { 1025 [OP_SETCLIENTID_CONFIRM] = {
1025 .op_func = (nfsd4op_func)nfsd4_setclientid_confirm, 1026 .op_func = (nfsd4op_func)nfsd4_setclientid_confirm,
@@ -1032,6 +1033,7 @@ static struct nfsd4_operation nfsd4_ops[OP_RELEASE_LOCKOWNER+1] = {
1032 }, 1033 },
1033 [OP_RELEASE_LOCKOWNER] = { 1034 [OP_RELEASE_LOCKOWNER] = {
1034 .op_func = (nfsd4op_func)nfsd4_release_lockowner, 1035 .op_func = (nfsd4op_func)nfsd4_release_lockowner,
1036 .op_flags = ALLOWED_ON_ABSENT_FS,
1035 }, 1037 },
1036}; 1038};
1037 1039