ceph: use rbtree for mon statfs requests

Previous thread: ceph: fix authentication races, auth_none oops by Linux Kernel Mailing List on Friday, March 19, 2010 - 10:00 am. (1 message)

Next thread: ceph: remove bogus invalidate_mapping_pages by Linux Kernel Mailing List on Friday, March 19, 2010 - 10:00 am. (1 message)
From: Linux Kernel Mailing List
Date: Friday, March 19, 2010 - 10:00 am

Gitweb:     http://git.kernel.org/linus/85ff03f6bfef7d5b59ab3aefd4773f497ffad8a4
Commit:     85ff03f6bfef7d5b59ab3aefd4773f497ffad8a4
Parent:     a105f00cf17d711e876b3dc67e15f9a89b7de5a3
Author:     Sage Weil <sage@newdream.net>
AuthorDate: Mon Feb 15 14:47:28 2010 -0800
Committer:  Sage Weil <sage@newdream.net>
CommitDate: Tue Feb 16 22:01:10 2010 -0800

    ceph: use rbtree for mon statfs requests
    
    An rbtree is lighter weight, particularly given we will generally have
    very few in-flight statfs requests.
    
    Signed-off-by: Sage Weil <sage@newdream.net>
---
 fs/ceph/debugfs.c    |   14 +++-------
 fs/ceph/mon_client.c |   67 +++++++++++++++++++++++++++++++++++---------------
 fs/ceph/mon_client.h |    5 ++-
 3 files changed, 54 insertions(+), 32 deletions(-)

diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index cd5dd80..b58bd91 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -112,9 +112,8 @@ static int monc_show(struct seq_file *s, void *p)
 {
 	struct ceph_client *client = s->private;
 	struct ceph_mon_statfs_request *req;
-	u64 nexttid = 0;
-	int got;
 	struct ceph_mon_client *monc = &client->monc;
+	struct rb_node *rp;
 
 	mutex_lock(&monc->mutex);
 
@@ -125,17 +124,12 @@ static int monc_show(struct seq_file *s, void *p)
 	if (monc->want_next_osdmap)
 		seq_printf(s, "want next osdmap\n");
 
-	while (nexttid < monc->last_tid) {
-		got = radix_tree_gang_lookup(&monc->statfs_request_tree,
-					     (void **)&req, nexttid, 1);
-		if (got == 0)
-			break;
-		nexttid = req->tid + 1;
-
+	for (rp = rb_first(&monc->statfs_request_tree); rp; rp = rb_next(rp)) {
+		req = rb_entry(rp, struct ceph_mon_statfs_request, node);
 		seq_printf(s, "%lld statfs\n", req->tid);
 	}
-	mutex_unlock(&monc->mutex);
 
+	mutex_unlock(&monc->mutex);
 	return 0;
 }
 
diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c
index fec41a0..542276e 100644
--- a/fs/ceph/mon_client.c
+++ b/fs/ceph/mon_client.c
@@ -343,6 +343,46 @@ out:
 /*
  * ...
Previous thread: ceph: fix authentication races, auth_none oops by Linux Kernel Mailing List on Friday, March 19, 2010 - 10:00 am. (1 message)

Next thread: ceph: remove bogus invalidate_mapping_pages by Linux Kernel Mailing List on Friday, March 19, 2010 - 10:00 am. (1 message)