diff options
author | J. Bruce Fields <bfields@redhat.com> | 2011-09-06 15:50:21 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2011-09-13 18:29:00 -0400 |
commit | 2288d0e3958b94bcc3c00a78ea06909a8eb66378 (patch) | |
tree | 0e3b5a475808e0ad05ab51c5beb34bd2b5c03910 /fs/nfsd | |
parent | c0a5d93efbbb79117bdf7f5f81fba9d679c35dfa (diff) |
nfsd4: pass around typemask instead of flags
We're only using those flags to choose lock or open stateid's at this
point.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 18 | ||||
-rw-r--r-- | fs/nfsd/state.h | 2 |
2 files changed, 8 insertions, 12 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index ad20bbf0a1f..48134635fc2 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1080,16 +1080,14 @@ static struct nfs4_stateid *find_stateid(stateid_t *t) | |||
1080 | return NULL; | 1080 | return NULL; |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | static struct nfs4_stateid *find_stateid_by_type(stateid_t *t, int flags) | 1083 | static struct nfs4_stateid *find_stateid_by_type(stateid_t *t, char typemask) |
1084 | { | 1084 | { |
1085 | struct nfs4_stateid *s; | 1085 | struct nfs4_stateid *s; |
1086 | 1086 | ||
1087 | s = find_stateid(t); | 1087 | s = find_stateid(t); |
1088 | if (!s) | 1088 | if (!s) |
1089 | return NULL; | 1089 | return NULL; |
1090 | if (flags & LOCK_STATE && s->st_type == NFS4_LOCK_STID) | 1090 | if (typemask & s->st_type) |
1091 | return s; | ||
1092 | if (flags & OPEN_STATE && s->st_type == NFS4_OPEN_STID) | ||
1093 | return s; | 1091 | return s; |
1094 | return NULL; | 1092 | return NULL; |
1095 | } | 1093 | } |
@@ -3445,7 +3443,7 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_ | |||
3445 | */ | 3443 | */ |
3446 | static __be32 | 3444 | static __be32 |
3447 | nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | 3445 | nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, |
3448 | stateid_t *stateid, int flags, | 3446 | stateid_t *stateid, char typemask, |
3449 | struct nfs4_stateid **stpp) | 3447 | struct nfs4_stateid **stpp) |
3450 | { | 3448 | { |
3451 | __be32 status; | 3449 | __be32 status; |
@@ -3457,7 +3455,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid, | |||
3457 | status = nfs4_nospecial_stateid_checks(stateid); | 3455 | status = nfs4_nospecial_stateid_checks(stateid); |
3458 | if (status) | 3456 | if (status) |
3459 | return status; | 3457 | return status; |
3460 | *stpp = find_stateid_by_type(stateid, flags); | 3458 | *stpp = find_stateid_by_type(stateid, typemask); |
3461 | if (*stpp == NULL) | 3459 | if (*stpp == NULL) |
3462 | return nfserr_expired; | 3460 | return nfserr_expired; |
3463 | cstate->replay_owner = (*stpp)->st_stateowner; | 3461 | cstate->replay_owner = (*stpp)->st_stateowner; |
@@ -3472,7 +3470,7 @@ static __be32 nfs4_preprocess_confirmed_seqid_op(struct nfsd4_compound_state *cs | |||
3472 | struct nfs4_openowner *oo; | 3470 | struct nfs4_openowner *oo; |
3473 | 3471 | ||
3474 | status = nfs4_preprocess_seqid_op(cstate, seqid, stateid, | 3472 | status = nfs4_preprocess_seqid_op(cstate, seqid, stateid, |
3475 | OPEN_STATE, stpp); | 3473 | NFS4_OPEN_STID, stpp); |
3476 | if (status) | 3474 | if (status) |
3477 | return status; | 3475 | return status; |
3478 | oo = openowner((*stpp)->st_stateowner); | 3476 | oo = openowner((*stpp)->st_stateowner); |
@@ -3501,7 +3499,7 @@ nfsd4_open_confirm(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3501 | 3499 | ||
3502 | status = nfs4_preprocess_seqid_op(cstate, | 3500 | status = nfs4_preprocess_seqid_op(cstate, |
3503 | oc->oc_seqid, &oc->oc_req_stateid, | 3501 | oc->oc_seqid, &oc->oc_req_stateid, |
3504 | OPEN_STATE, &stp); | 3502 | NFS4_OPEN_STID, &stp); |
3505 | if (status) | 3503 | if (status) |
3506 | goto out; | 3504 | goto out; |
3507 | oo = openowner(stp->st_stateowner); | 3505 | oo = openowner(stp->st_stateowner); |
@@ -3999,7 +3997,7 @@ nfsd4_lock(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
3999 | status = nfs4_preprocess_seqid_op(cstate, | 3997 | status = nfs4_preprocess_seqid_op(cstate, |
4000 | lock->lk_old_lock_seqid, | 3998 | lock->lk_old_lock_seqid, |
4001 | &lock->lk_old_lock_stateid, | 3999 | &lock->lk_old_lock_stateid, |
4002 | LOCK_STATE, &lock_stp); | 4000 | NFS4_LOCK_STID, &lock_stp); |
4003 | if (status) | 4001 | if (status) |
4004 | goto out; | 4002 | goto out; |
4005 | lock_sop = lockowner(lock_stp->st_stateowner); | 4003 | lock_sop = lockowner(lock_stp->st_stateowner); |
@@ -4197,7 +4195,7 @@ nfsd4_locku(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | |||
4197 | nfs4_lock_state(); | 4195 | nfs4_lock_state(); |
4198 | 4196 | ||
4199 | status = nfs4_preprocess_seqid_op(cstate, locku->lu_seqid, | 4197 | status = nfs4_preprocess_seqid_op(cstate, locku->lu_seqid, |
4200 | &locku->lu_stateid, LOCK_STATE, &stp); | 4198 | &locku->lu_stateid, NFS4_LOCK_STID, &stp); |
4201 | if (status) | 4199 | if (status) |
4202 | goto out; | 4200 | goto out; |
4203 | filp = find_any_file(stp->st_file); | 4201 | filp = find_any_file(stp->st_file); |
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index 9745cc781e7..ef949eb3a86 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
@@ -463,8 +463,6 @@ struct nfs4_stateid { | |||
463 | }; | 463 | }; |
464 | 464 | ||
465 | /* flags for preprocess_seqid_op() */ | 465 | /* flags for preprocess_seqid_op() */ |
466 | #define OPEN_STATE 0x00000004 | ||
467 | #define LOCK_STATE 0x00000008 | ||
468 | #define RD_STATE 0x00000010 | 466 | #define RD_STATE 0x00000010 |
469 | #define WR_STATE 0x00000020 | 467 | #define WR_STATE 0x00000020 |
470 | 468 | ||