diff options
author | Yehuda Sadeh <yehuda@hq.newdream.net> | 2010-05-17 15:31:35 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-10-20 18:35:36 -0400 |
commit | 7669a2c95e502a77f93f27e5449fc93a00d588b6 (patch) | |
tree | 4230c625bf5781d1cb3cf6b1e38b2d0ef103234c /fs/ceph | |
parent | cd07202cc8262e1669edff0d97715f3dd9260917 (diff) |
ceph: lookup pool in osdmap by name
Implement a pool lookup by name. This will be used by rbd.
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/osdmap.c | 13 | ||||
-rw-r--r-- | fs/ceph/osdmap.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c index e31f118f1392..3ccd11761cb6 100644 --- a/fs/ceph/osdmap.c +++ b/fs/ceph/osdmap.c | |||
@@ -417,6 +417,19 @@ static struct ceph_pg_pool_info *__lookup_pg_pool(struct rb_root *root, int id) | |||
417 | return NULL; | 417 | return NULL; |
418 | } | 418 | } |
419 | 419 | ||
420 | int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name) | ||
421 | { | ||
422 | struct rb_node *rbp; | ||
423 | |||
424 | for (rbp = rb_first(&map->pg_pools); rbp; rbp = rb_next(rbp)) { | ||
425 | struct ceph_pg_pool_info *pi = | ||
426 | rb_entry(rbp, struct ceph_pg_pool_info, node); | ||
427 | if (pi->name && strcmp(pi->name, name) == 0) | ||
428 | return pi->id; | ||
429 | } | ||
430 | return -ENOENT; | ||
431 | } | ||
432 | |||
420 | static void __remove_pg_pool(struct rb_root *root, struct ceph_pg_pool_info *pi) | 433 | static void __remove_pg_pool(struct rb_root *root, struct ceph_pg_pool_info *pi) |
421 | { | 434 | { |
422 | rb_erase(&pi->node, root); | 435 | rb_erase(&pi->node, root); |
diff --git a/fs/ceph/osdmap.h b/fs/ceph/osdmap.h index 970b547e510d..a592b211be39 100644 --- a/fs/ceph/osdmap.h +++ b/fs/ceph/osdmap.h | |||
@@ -125,4 +125,6 @@ extern int ceph_calc_pg_acting(struct ceph_osdmap *osdmap, struct ceph_pg pgid, | |||
125 | extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap, | 125 | extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap, |
126 | struct ceph_pg pgid); | 126 | struct ceph_pg pgid); |
127 | 127 | ||
128 | extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name); | ||
129 | |||
128 | #endif | 130 | #endif |