diff options
author | Sage Weil <sage@newdream.net> | 2010-02-15 17:37:55 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-02-17 01:01:09 -0500 |
commit | a105f00cf17d711e876b3dc67e15f9a89b7de5a3 (patch) | |
tree | 59c4b280aa92e9910670ee7fd274f21bc3659a04 /fs/ceph/mds_client.c | |
parent | 44ca18f2682eb1cfbed153849adedb79e3e19790 (diff) |
ceph: use rbtree for snap_realms
Switch from radix tree to rbtree for snap realms. This is much more
appropriate given that realm keys are few and far between.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r-- | fs/ceph/mds_client.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 81840d6b68a4..02834cecc3a0 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -2097,9 +2097,8 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds) | |||
2097 | { | 2097 | { |
2098 | struct ceph_mds_session *session = NULL; | 2098 | struct ceph_mds_session *session = NULL; |
2099 | struct ceph_msg *reply; | 2099 | struct ceph_msg *reply; |
2100 | struct rb_node *p; | ||
2100 | int err; | 2101 | int err; |
2101 | int got; | ||
2102 | u64 next_snap_ino = 0; | ||
2103 | struct ceph_pagelist *pagelist; | 2102 | struct ceph_pagelist *pagelist; |
2104 | 2103 | ||
2105 | pr_info("reconnect to recovering mds%d\n", mds); | 2104 | pr_info("reconnect to recovering mds%d\n", mds); |
@@ -2155,14 +2154,10 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds) | |||
2155 | * parent for all of our realms. If the mds has any newer info, | 2154 | * parent for all of our realms. If the mds has any newer info, |
2156 | * it will tell us. | 2155 | * it will tell us. |
2157 | */ | 2156 | */ |
2158 | next_snap_ino = 0; | 2157 | for (p = rb_first(&mdsc->snap_realms); p; p = rb_next(p)) { |
2159 | while (1) { | 2158 | struct ceph_snap_realm *realm = |
2160 | struct ceph_snap_realm *realm; | 2159 | rb_entry(p, struct ceph_snap_realm, node); |
2161 | struct ceph_mds_snaprealm_reconnect sr_rec; | 2160 | struct ceph_mds_snaprealm_reconnect sr_rec; |
2162 | got = radix_tree_gang_lookup(&mdsc->snap_realms, | ||
2163 | (void **)&realm, next_snap_ino, 1); | ||
2164 | if (!got) | ||
2165 | break; | ||
2166 | 2161 | ||
2167 | dout(" adding snap realm %llx seq %lld parent %llx\n", | 2162 | dout(" adding snap realm %llx seq %lld parent %llx\n", |
2168 | realm->ino, realm->seq, realm->parent_ino); | 2163 | realm->ino, realm->seq, realm->parent_ino); |
@@ -2172,7 +2167,6 @@ static void send_mds_reconnect(struct ceph_mds_client *mdsc, int mds) | |||
2172 | err = ceph_pagelist_append(pagelist, &sr_rec, sizeof(sr_rec)); | 2167 | err = ceph_pagelist_append(pagelist, &sr_rec, sizeof(sr_rec)); |
2173 | if (err) | 2168 | if (err) |
2174 | goto fail; | 2169 | goto fail; |
2175 | next_snap_ino = realm->ino + 1; | ||
2176 | } | 2170 | } |
2177 | 2171 | ||
2178 | send: | 2172 | send: |
@@ -2603,7 +2597,7 @@ int ceph_mdsc_init(struct ceph_mds_client *mdsc, struct ceph_client *client) | |||
2603 | mdsc->max_sessions = 0; | 2597 | mdsc->max_sessions = 0; |
2604 | mdsc->stopping = 0; | 2598 | mdsc->stopping = 0; |
2605 | init_rwsem(&mdsc->snap_rwsem); | 2599 | init_rwsem(&mdsc->snap_rwsem); |
2606 | INIT_RADIX_TREE(&mdsc->snap_realms, GFP_NOFS); | 2600 | mdsc->snap_realms = RB_ROOT; |
2607 | INIT_LIST_HEAD(&mdsc->snap_empty); | 2601 | INIT_LIST_HEAD(&mdsc->snap_empty); |
2608 | spin_lock_init(&mdsc->snap_empty_lock); | 2602 | spin_lock_init(&mdsc->snap_empty_lock); |
2609 | mdsc->last_tid = 0; | 2603 | mdsc->last_tid = 0; |