2005-03-08 06:07:24

by NeilBrown

[permalink] [raw]
Subject: [PATCH kNFSd 27 of 54] nfsd4: simplify find_openstateowner_str



There's no need to return duplicate information through the return value and an
argument. Other minor cleanup.

Signed-off-by: J. Bruce Fields <[email protected]>
Signed-off-by: Neil Brown <[email protected]>

### Diffstat output
./fs/nfsd/nfs4state.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)

diff ./fs/nfsd/nfs4state.c~current~ ./fs/nfsd/nfs4state.c
--- ./fs/nfsd/nfs4state.c~current~ 2005-03-07 11:35:58.000000000 +1100
+++ ./fs/nfsd/nfs4state.c 2005-03-07 11:35:58.000000000 +1100
@@ -1233,18 +1233,16 @@ cmp_owner_str(struct nfs4_stateowner *so
(sop->so_client->cl_clientid.cl_id == clid->cl_id));
}

-/* search ownerstr_hashtbl[] for owner */
-static int
-find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open, struct nfs4_stateowner **op) {
- struct nfs4_stateowner *local = NULL;
+static struct nfs4_stateowner *
+find_openstateowner_str(unsigned int hashval, struct nfsd4_open *open)
+{
+ struct nfs4_stateowner *so = NULL;

- list_for_each_entry(local, &ownerstr_hashtbl[hashval], so_strhash) {
- if (!cmp_owner_str(local, &open->op_owner, &open->op_clientid))
- continue;
- *op = local;
- return(1);
+ list_for_each_entry(so, &ownerstr_hashtbl[hashval], so_strhash) {
+ if (cmp_owner_str(so, &open->op_owner, &open->op_clientid))
+ return so;
}
- return 0;
+ return NULL;
}

/* search file_hashtbl[] for file */
@@ -1461,7 +1459,8 @@ nfsd4_process_open1(struct nfsd4_open *o
return nfserr_stale_clientid;

strhashval = ownerstr_hashval(clientid->cl_id, open->op_owner);
- if (find_openstateowner_str(strhashval, open, &sop)) {
+ sop = find_openstateowner_str(strhashval, open);
+ if (sop) {
open->op_stateowner = sop;
/* check for replay */
if (open->op_seqid == sop->so_seqid){
@@ -1504,7 +1503,8 @@ nfsd4_process_open1(struct nfsd4_open *o
goto out;
}
status = nfserr_resource;
- if (!(sop = alloc_init_open_stateowner(strhashval, clp, open)))
+ sop = alloc_init_open_stateowner(strhashval, clp, open);
+ if (sop == NULL)
goto out;
open->op_stateowner = sop;
renew:


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs