From patchwork Wed Jul 7 22:11:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yehuda Sadeh X-Patchwork-Id: 110728 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o67LphMJ031422 for ; Wed, 7 Jul 2010 21:51:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758060Ab0GGVu3 (ORCPT ); Wed, 7 Jul 2010 17:50:29 -0400 Received: from mail.hq.newdream.net ([66.33.206.127]:34446 "EHLO mail.hq.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757646Ab0GGVu0 (ORCPT ); Wed, 7 Jul 2010 17:50:26 -0400 Received: from mail.hq.newdream.net (localhost [127.0.0.1]) by mail.hq.newdream.net (Postfix) with ESMTP id 465AE2705D; Wed, 7 Jul 2010 14:50:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=hq.newdream.net; h=from:to :cc:subject:date:message-id:in-reply-to:references:in-reply-to :references; s=drama; bh=CmtNK/wP83P6HRNALlBj6n1PKLw=; b=FFE7noQ debtRsxDd2GRNOrRRRykiqvDUsXbLfWD+4Q5rCw3UwvunWtU2uZ0rXZSfVSXABvU Q6G8J/RGQBjMsyhHklvAfESoqVYidXp3/BKELChCCrFd5r4nsGGLo9IygiwauOO2 yqjuOuy7u6o2a0GlIOVJUmZnuJFlo++lbbhA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=hq.newdream.net; h=from:to :cc:subject:date:message-id:in-reply-to:references:in-reply-to :references; q=dns; s=drama; b=gGnCFU5dO9B5FR1ui9speYXRKmz8nV8Rr yNedENSFDHl2y87vh4YLezcqKRV0pWng6xn4xzYHSPT9lF1pbyw69BaD2S6+/D60 Ntbkh3xtOcROuUD6+MrcCpoMEwvYlT/3X+21KwUdz4i9cr5adzD6T44mLLn4Dh5t /abY463+MY= Received: from localhost.localdomain (ip-66-33-206-8.dreamhost.com [66.33.206.8]) by mail.hq.newdream.net (Postfix) with ESMTP id 3F5382705A; Wed, 7 Jul 2010 14:50:26 -0700 (PDT) From: Yehuda Sadeh To: linux-kernel@vger.kernel.org Cc: ceph-devel@vger.kernel.org, linux-fsdevel@vger.kernel.org, sage@newdream.net, Yehuda Sadeh Subject: [PATCH v3 01/10] ceph-rbd: lookup pool in osdmap by name Date: Wed, 7 Jul 2010 15:11:23 -0700 Message-Id: <9e565a8e094a7a59730adcece64d1b4a12adf39f.1278539315.git.yehuda@hq.newdream.net> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: References: In-Reply-To: References: Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 07 Jul 2010 21:51:43 +0000 (UTC) diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c index ddc656f..11aac1c 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) return NULL; } +int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name) +{ + struct rb_node *rbp; + + for (rbp = rb_first(&map->pg_pools); rbp; rbp = rb_next(rbp)) { + struct ceph_pg_pool_info *pi = + rb_entry(rbp, struct ceph_pg_pool_info, node); + if (pi->name && strcmp(pi->name, name) == 0) + return pi->id; + } + return -ENOENT; +} + static void __remove_pg_pool(struct rb_root *root, struct ceph_pg_pool_info *pi) { rb_erase(&pi->node, root); diff --git a/fs/ceph/osdmap.h b/fs/ceph/osdmap.h index 970b547..a592b21 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, extern int ceph_calc_pg_primary(struct ceph_osdmap *osdmap, struct ceph_pg pgid); +extern int ceph_pg_poolid_by_name(struct ceph_osdmap *map, const char *name); + #endif