CEPH filesystem development
 help / color / mirror / Atom feed
From: Alex Elder <elder@inktank.com>
To: ceph-devel <ceph-devel@vger.kernel.org>
Subject: [PATCH 4/6] libceph: define ceph_pg_pool_name_by_id()
Date: Tue, 30 Oct 2012 20:49:35 -0500	[thread overview]
Message-ID: <509083AF.1000000@inktank.com> (raw)
In-Reply-To: <509081C4.3050402@inktank.com>

Define and export function ceph_pg_pool_name_by_id() to supply
the name of a pg pool whose id is given.  This will be used by
the next patch.

Signed-off-by: Alex Elder <elder@inktank.com>
---
 include/linux/ceph/osdmap.h |    1 +
 net/ceph/osdmap.c           |   16 ++++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index e88a620..5ea57ba 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -123,6 +123,7 @@ extern int ceph_calc_pg_acting(struct ceph_osdmap
*osdmap, struct ceph_pg pgid,
 extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap,
 				struct ceph_pg pgid);

+extern const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64
id);
 extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char
*name);

 #endif
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index f552aa4..de73214 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -469,6 +469,22 @@ static struct ceph_pg_pool_info
*__lookup_pg_pool(struct rb_root *root, int id)
 	return NULL;
 }

+const char *ceph_pg_pool_name_by_id(struct ceph_osdmap *map, u64 id)
+{
+	struct ceph_pg_pool_info *pi;
+
+	if (id == CEPH_NOPOOL)
+		return NULL;
+
+	if (WARN_ON_ONCE(id > (u64) INT_MAX))
+		return NULL;
+
+	pi = __lookup_pg_pool(&map->pg_pools, (int) id);
+
+	return pi ? pi->name : NULL;
+}
+EXPORT_SYMBOL(ceph_pg_pool_name_by_id);
+
 int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name)
 {
 	struct rb_node *rbp;
-- 
1.7.9.5


  parent reply	other threads:[~2012-10-31  1:49 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31  1:41 [PATCH 0/6] rbd: version 2 parent probing Alex Elder
2012-10-31  1:49 ` [PATCH 1/6] rbd: skip getting image id if known Alex Elder
2012-10-31 21:05   ` Josh Durgin
2012-10-31  1:49 ` [PATCH 2/6] rbd: allow null image name Alex Elder
2012-10-31 21:07   ` Josh Durgin
2012-10-31  1:49 ` [PATCH 3/6] rbd: get parent spec for version 2 images Alex Elder
2012-11-01  1:33   ` Josh Durgin
2012-10-31  1:49 ` Alex Elder [this message]
2012-11-01  1:34   ` [PATCH 4/6] libceph: define ceph_pg_pool_name_by_id() Josh Durgin
2012-10-31  1:49 ` [PATCH 5/6] rbd: get additional info in parent spec Alex Elder
2012-10-31 14:11   ` Alex Elder
2012-11-01  1:49   ` Josh Durgin
2012-11-01 12:18     ` Alex Elder
2012-10-31  1:50 ` [PATCH 6/6] rbd: probe the parent of an image if present Alex Elder
2012-10-31 11:59   ` slow fio random read benchmark, need help Alexandre DERUMIER
2012-10-31 15:57     ` Sage Weil
2012-10-31 16:29       ` Alexandre DERUMIER
2012-10-31 16:50         ` Alexandre DERUMIER
2012-10-31 17:08         ` Marcus Sorensen
2012-10-31 17:27           ` Alexandre DERUMIER
2012-10-31 17:38             ` Marcus Sorensen
2012-10-31 18:56               ` Alexandre DERUMIER
2012-10-31 19:50                 ` Marcus Sorensen
2012-11-01  5:11                   ` Alexandre DERUMIER
2012-11-01  5:41                     ` Stefan Priebe - Profihost AG
2012-10-31 20:22                 ` Josh Durgin
2012-11-01  7:38             ` Dietmar Maurer
2012-11-01  8:08               ` Stefan Priebe - Profihost AG
2012-11-01 10:40               ` Gregory Farnum
2012-11-01 10:54                 ` Stefan Priebe - Profihost AG
2012-11-02  9:38                   ` Alexandre DERUMIER
2012-11-03 10:01                     ` slow fio random read benchmark: last librbd git : 20000iops ! Alexandre DERUMIER
2012-11-03 12:09                       ` Alexandre DERUMIER
2012-11-01 15:46                 ` slow fio random read benchmark, need help Marcus Sorensen
2012-11-01 16:28                   ` Marcus Sorensen
2012-11-01 17:00                     ` Dietmar Maurer
2012-11-03 17:09                       ` Gregory Farnum
2012-11-04 14:54                         ` Alexandre DERUMIER
2012-11-01  2:07   ` [PATCH 6/6] rbd: probe the parent of an image if present Josh Durgin
2012-11-01 12:26     ` Alex Elder

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=509083AF.1000000@inktank.com \
    --to=elder@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    /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