aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-08-11 18:50:18 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-08-27 14:21:23 -0400
commit506f275fffcaceb8abe3db69e581d86c7da48a82 (patch)
treecabf1ee6288e3437c806610038fbc5157fba8f93 /fs/nfsd/nfs4state.c
parentddc04c41636f8cd374d72cdd3a0fcaa916fbc5d0 (diff)
nfsd4: name openowner data structures more clearly
These appear to be generic (for both open and lock owners), but they're actually just for open owners. This has confused me more than once. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index ce8e70cd04c5..dd6424face32 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -134,27 +134,27 @@ unsigned int max_delegations;
134 * Open owner state (share locks) 134 * Open owner state (share locks)
135 */ 135 */
136 136
137/* hash tables for nfs4_stateowner */ 137/* hash tables for open owners */
138#define OWNER_HASH_BITS 8 138#define OPEN_OWNER_HASH_BITS 8
139#define OWNER_HASH_SIZE (1 << OWNER_HASH_BITS) 139#define OPEN_OWNER_HASH_SIZE (1 << OPEN_OWNER_HASH_BITS)
140#define OWNER_HASH_MASK (OWNER_HASH_SIZE - 1) 140#define OPEN_OWNER_HASH_MASK (OPEN_OWNER_HASH_SIZE - 1)
141 141
142static unsigned int ownerid_hashval(const u32 id) 142static unsigned int open_ownerid_hashval(const u32 id)
143{ 143{
144 return id & OWNER_HASH_MASK; 144 return id & OPEN_OWNER_HASH_MASK;
145} 145}
146 146
147static unsigned int ownerstr_hashval(u32 clientid, struct xdr_netobj *ownername) 147static unsigned int open_ownerstr_hashval(u32 clientid, struct xdr_netobj *ownername)
148{ 148{
149 unsigned int ret; 149 unsigned int ret;
150 150
151 ret = opaque_hashval(ownername->data, ownername->len); 151 ret = opaque_hashval(ownername->data, ownername->len);
152 ret += clientid; 152 ret += clientid;
153 return ret & OWNER_HASH_MASK; 153 return ret & OPEN_OWNER_HASH_MASK;
154} 154}
155 155
156static struct list_head ownerid_hashtbl[OWNER_HASH_SIZE]; 156static struct list_head open_ownerid_hashtbl[OPEN_OWNER_HASH_SIZE];
157static struct list_head ownerstr_hashtbl[OWNER_HASH_SIZE]; 157static struct list_head open_ownerstr_hashtbl[OPEN_OWNER_HASH_SIZE];
158 158
159/* hash table for nfs4_file */ 159/* hash table for nfs4_file */
160#define FILE_HASH_BITS 8 160#define FILE_HASH_BITS 8
@@ -2240,7 +2240,7 @@ alloc_init_open_stateowner(unsigned int strhashval, struct nfs4_client *clp, str
2240 2240
2241 if (!(sop = alloc_stateowner(&open->op_owner))) 2241 if (!(sop = alloc_stateowner(&open->op_owner)))
2242 return NULL; 2242 return NULL;
2243 idhashval = ownerid_hashval(current_ownerid); 2243 idhashval = open_ownerid_hashval(current_ownerid);
2244 INIT_LIST_HEAD(&sop->so_idhash); 2244 INIT_LIST_HEAD(&sop->so_idhash);
2245 INIT_LIST_HEAD(&sop->so_strhash); 2245 INIT_LIST_HEAD(&sop->so_strhash);
2246 INIT_LIST_HEAD(&sop->so_perclient); 2246 INIT_LIST_HEAD(&sop->so_perclient);
@@ -2248,8 +2248,8 @@ alloc_init_open_stateowner(unsigned int strhashval, struct nfs4_client *clp, str
2248 INIT_LIST_HEAD(&sop->so_perstateid); /* not used */ 2248 INIT_LIST_HEAD(&sop->so_perstateid); /* not used */
2249 INIT_LIST_HEAD(&sop->so_close_lru); 2249 INIT_LIST_HEAD(&sop->so_close_lru);
2250 sop->so_time = 0; 2250 sop->so_time = 0;
2251 list_add(&sop->so_idhash, &ownerid_hashtbl[idhashval]); 2251 list_add(&sop->so_idhash, &open_ownerid_hashtbl[idhashval]);
2252 list_add(&sop->so_strhash, &ownerstr_hashtbl[strhashval]); 2252 list_add(&sop->so_strhash, &open_ownerstr_hashtbl[strhashval]);
2253 list_add(&sop->so_perclient, &clp->cl_openowners); 2253 list_add(&sop->so_perclient, &clp->cl_openowners);
2254 sop->so_is_open_owner = 1; 2254 sop->so_is_open_owner = 1;
2255 sop->so_id = current_ownerid++; 2255 sop->so_id = current_ownerid++;
@@ -2313,7 +2313,7 @@ find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open)
2313{ 2313{
2314 struct nfs4_stateowner *so = NULL; 2314 struct nfs4_stateowner *so = NULL;
2315 2315
2316 list_for_each_entry(so, &ownerstr_hashtbl[hashval], so_strhash) { 2316 list_for_each_entry(so, &open_ownerstr_hashtbl[hashval], so_strhash) {
2317 if (same_owner_str(so, &open->op_owner, &open->op_clientid)) 2317 if (same_owner_str(so, &open->op_owner, &open->op_clientid))
2318 return so; 2318 return so;
2319 } 2319 }
@@ -2464,7 +2464,7 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate,
2464 if (STALE_CLIENTID(&open->op_clientid)) 2464 if (STALE_CLIENTID(&open->op_clientid))
2465 return nfserr_stale_clientid; 2465 return nfserr_stale_clientid;
2466 2466
2467 strhashval = ownerstr_hashval(clientid->cl_id, &open->op_owner); 2467 strhashval = open_ownerstr_hashval(clientid->cl_id, &open->op_owner);
2468 sop = find_openstateowner_str(strhashval, open); 2468 sop = find_openstateowner_str(strhashval, open);
2469 open->op_stateowner = sop; 2469 open->op_stateowner = sop;
2470 if (!sop) { 2470 if (!sop) {
@@ -4518,9 +4518,9 @@ nfs4_state_init(void)
4518 for (i = 0; i < FILE_HASH_SIZE; i++) { 4518 for (i = 0; i < FILE_HASH_SIZE; i++) {
4519 INIT_LIST_HEAD(&file_hashtbl[i]); 4519 INIT_LIST_HEAD(&file_hashtbl[i]);
4520 } 4520 }
4521 for (i = 0; i < OWNER_HASH_SIZE; i++) { 4521 for (i = 0; i < OPEN_OWNER_HASH_SIZE; i++) {
4522 INIT_LIST_HEAD(&ownerstr_hashtbl[i]); 4522 INIT_LIST_HEAD(&open_ownerstr_hashtbl[i]);
4523 INIT_LIST_HEAD(&ownerid_hashtbl[i]); 4523 INIT_LIST_HEAD(&open_ownerid_hashtbl[i]);
4524 } 4524 }
4525 for (i = 0; i < STATEID_HASH_SIZE; i++) { 4525 for (i = 0; i < STATEID_HASH_SIZE; i++) {
4526 INIT_LIST_HEAD(&stateid_hashtbl[i]); 4526 INIT_LIST_HEAD(&stateid_hashtbl[i]);