From: Chuck Lever <chuck.lever@oracle.com>
To: trond.myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 1/2] NFS: Clean up nfs4_find_state_owners_locked()
Date: Tue, 06 Dec 2011 16:13:39 -0500 [thread overview]
Message-ID: <20111206211339.5969.64168.stgit@degas.1015granger.net> (raw)
In-Reply-To: <20111206210723.5969.85159.stgit@degas.1015granger.net>
There's no longer a need to check the so_server field in the state
owner, because nowadays the RB tree we search for state owners
contains owners for that only server.
Make nfs4_find_state_owners_locked() use the same tree searching logic
as nfs4_insert_state_owner_locked().
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
fs/nfs/nfs4state.c | 15 +++------------
1 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 39914be..8794b82 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -377,31 +377,22 @@ nfs4_find_state_owner_locked(struct nfs_server *server, struct rpc_cred *cred)
{
struct rb_node **p = &server->state_owners.rb_node,
*parent = NULL;
- struct nfs4_state_owner *sp, *res = NULL;
+ struct nfs4_state_owner *sp;
while (*p != NULL) {
parent = *p;
sp = rb_entry(parent, struct nfs4_state_owner, so_server_node);
- if (server < sp->so_server) {
- p = &parent->rb_left;
- continue;
- }
- if (server > sp->so_server) {
- p = &parent->rb_right;
- continue;
- }
if (cred < sp->so_cred)
p = &parent->rb_left;
else if (cred > sp->so_cred)
p = &parent->rb_right;
else {
atomic_inc(&sp->so_count);
- res = sp;
- break;
+ return sp;
}
}
- return res;
+ return NULL;
}
static struct nfs4_state_owner *
next prev parent reply other threads:[~2011-12-06 21:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-06 21:13 [PATCH 0/2] Cache state owners [take 2] Chuck Lever
2011-12-06 21:13 ` Chuck Lever [this message]
2011-12-06 21:13 ` [PATCH 2/2] NFS: Cache state owners after files are closed Chuck Lever
2012-01-04 15:53 ` Trond Myklebust
2012-01-04 15:59 ` Trond Myklebust
2012-01-04 16:08 ` Chuck Lever
2012-01-04 16:14 ` Trond Myklebust
2012-01-04 17:07 ` Chuck Lever
2012-01-04 17:14 ` Trond Myklebust
2012-01-04 21:52 ` [PATCH] NFS: Fix a few issues with cached state owners Trond Myklebust
2012-01-04 21:56 ` Chuck Lever
2012-01-04 21:58 ` Chuck Lever
2012-01-04 22:03 ` Trond Myklebust
2012-01-04 22:07 ` Chuck Lever
2012-01-04 22:27 ` [PATCH] NFS: Cache state owners after files are closed Trond Myklebust
2012-01-04 22:29 ` Trond Myklebust
2012-01-04 22:39 ` Chuck Lever
2012-01-04 23:10 ` Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111206211339.5969.64168.stgit@degas.1015granger.net \
--to=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@netapp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).