aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-09-06 14:56:09 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-09-13 18:25:39 -0400
commit4581d1409977c5fe686a4ed487cdce2e50031826 (patch)
tree2481dff3f61bf614384e9e00848f68d97c042a09 /fs
parent4665e2bac5076d02264f4a4d79edafa05ec7b752 (diff)
nfsd4: rearrange to avoid a forward reference
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4state.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index c28432a80210..f0eccc236a0d 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -60,7 +60,6 @@ static u64 current_sessionid = 1;
60#define ONE_STATEID(stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t))) 60#define ONE_STATEID(stateid) (!memcmp((stateid), &onestateid, sizeof(stateid_t)))
61 61
62/* forward declarations */ 62/* forward declarations */
63static struct nfs4_stateid * find_stateid(stateid_t *stid, int flags);
64static struct nfs4_delegation * search_for_delegation(stateid_t *stid); 63static struct nfs4_delegation * search_for_delegation(stateid_t *stid);
65static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid); 64static struct nfs4_delegation * find_delegation_stateid(struct inode *ino, stateid_t *stid);
66static int check_for_locks(struct nfs4_file *filp, struct nfs4_lockowner *lowner); 65static int check_for_locks(struct nfs4_file *filp, struct nfs4_lockowner *lowner);
@@ -1061,6 +1060,32 @@ static void gen_confirm(struct nfs4_client *clp)
1061 *p++ = i++; 1060 *p++ = i++;
1062} 1061}
1063 1062
1063static int
1064same_stateid(stateid_t *id_one, stateid_t *id_two)
1065{
1066 if (id_one->si_stateownerid != id_two->si_stateownerid)
1067 return 0;
1068 return id_one->si_fileid == id_two->si_fileid;
1069}
1070
1071static struct nfs4_stateid *find_stateid(stateid_t *t, int flags)
1072{
1073 struct nfs4_stateid *s;
1074 unsigned int hashval;
1075
1076 hashval = stateid_hashval(t->si_stateownerid, t->si_fileid);
1077 list_for_each_entry(s, &stateid_hashtbl[hashval], st_hash) {
1078 if (!same_stateid(&s->st_stateid, t))
1079 continue;
1080 if (flags & LOCK_STATE && s->st_type != NFS4_LOCK_STID)
1081 return NULL;
1082 if (flags & OPEN_STATE && s->st_type != NFS4_OPEN_STID)
1083 return NULL;
1084 return s;
1085 }
1086 return NULL;
1087}
1088
1064static struct nfs4_client *create_client(struct xdr_netobj name, char *recdir, 1089static struct nfs4_client *create_client(struct xdr_netobj name, char *recdir,
1065 struct svc_rqst *rqstp, nfs4_verifier *verf) 1090 struct svc_rqst *rqstp, nfs4_verifier *verf)
1066{ 1091{
@@ -3694,32 +3719,6 @@ lock_ownerstr_hashval(struct inode *inode, u32 cl_id,
3694static struct list_head lock_ownerid_hashtbl[LOCK_HASH_SIZE]; 3719static struct list_head lock_ownerid_hashtbl[LOCK_HASH_SIZE];
3695static struct list_head lock_ownerstr_hashtbl[LOCK_HASH_SIZE]; 3720static struct list_head lock_ownerstr_hashtbl[LOCK_HASH_SIZE];
3696 3721
3697static int
3698same_stateid(stateid_t *id_one, stateid_t *id_two)
3699{
3700 if (id_one->si_stateownerid != id_two->si_stateownerid)
3701 return 0;
3702 return id_one->si_fileid == id_two->si_fileid;
3703}
3704
3705static struct nfs4_stateid *find_stateid(stateid_t *t, int flags)
3706{
3707 struct nfs4_stateid *s;
3708 unsigned int hashval;
3709
3710 hashval = stateid_hashval(t->si_stateownerid, t->si_fileid);
3711 list_for_each_entry(s, &stateid_hashtbl[hashval], st_hash) {
3712 if (!same_stateid(&s->st_stateid, t))
3713 continue;
3714 if (flags & LOCK_STATE && s->st_type != NFS4_LOCK_STID)
3715 return NULL;
3716 if (flags & OPEN_STATE && s->st_type != NFS4_OPEN_STID)
3717 return NULL;
3718 return s;
3719 }
3720 return NULL;
3721}
3722
3723static struct nfs4_delegation * 3722static struct nfs4_delegation *
3724search_for_delegation(stateid_t *stid) 3723search_for_delegation(stateid_t *stid)
3725{ 3724{