From patchwork Thu Mar 27 18:18:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 3899271 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3BAFEBF540 for ; Thu, 27 Mar 2014 18:19:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C7D520253 for ; Thu, 27 Mar 2014 18:19:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 22E4520225 for ; Thu, 27 Mar 2014 18:19:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757128AbaC0STH (ORCPT ); Thu, 27 Mar 2014 14:19:07 -0400 Received: from mail-ee0-f51.google.com ([74.125.83.51]:57919 "EHLO mail-ee0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757121AbaC0STG (ORCPT ); Thu, 27 Mar 2014 14:19:06 -0400 Received: by mail-ee0-f51.google.com with SMTP id c13so3220389eek.38 for ; Thu, 27 Mar 2014 11:19:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=nBPfR9zZy+rxCxetI+yJBpakh5Rpxu2sjZauOjbDHt8=; b=YE9rIGxDWbw0E5An6IjrjlgEQYzkuC3aeCNFqs75xCRSn2jvUSvVk+2CAL63brqRQH w5giMnImPEGfgeblxP8J8qUDP92hj90Nueqr0a+ZEW1Pptbrj3cmFKMM2eP6WhElh0ql 981lLa6g9UFDqse6Pqa/BLbjfZFWz5WxVgEac9ka/Ik40m5BkQoQ1+yQZugCDJGDGAR0 4qcG58JpySPKV87JBBzyzhHO3FLe1EVAOwJvkExhuu0/RSBFbW4/TtlZjFIfcjB1sDUY Zp4R0+97K4CfbNiVJgf693d4u5ElHIsqKEMMsUQ0iUiHKObNHeIsalBChf0n9zE45SQz HE/g== X-Gm-Message-State: ALoCoQlQJnbn+pnE+jDJHRDV0IcqIRki0dmmfaCF/JWJhcVONKmi+gP6ZQGa5Hx+qMXQVwKMo4dw X-Received: by 10.14.206.137 with SMTP id l9mr3201021eeo.40.1395944344829; Thu, 27 Mar 2014 11:19:04 -0700 (PDT) Received: from localhost ([109.110.66.7]) by mx.google.com with ESMTPSA id a42sm5981895ees.10.2014.03.27.11.19.03 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 27 Mar 2014 11:19:04 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 18/33] libceph: generalize ceph_pg_mapping Date: Thu, 27 Mar 2014 20:18:04 +0200 Message-Id: <1395944299-21970-19-git-send-email-ilya.dryomov@inktank.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395944299-21970-1-git-send-email-ilya.dryomov@inktank.com> References: <1395944299-21970-1-git-send-email-ilya.dryomov@inktank.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In preparation for adding support for primary_temp mappings, generalize struct ceph_pg_mapping so it can hold mappings other than pg_temp. Signed-off-by: Ilya Dryomov --- include/linux/ceph/osdmap.h | 9 +++++++-- net/ceph/debugfs.c | 4 ++-- net/ceph/osdmap.c | 8 ++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h index 46c3e304c3d8..4837e58e3203 100644 --- a/include/linux/ceph/osdmap.h +++ b/include/linux/ceph/osdmap.h @@ -60,8 +60,13 @@ struct ceph_object_id { struct ceph_pg_mapping { struct rb_node node; struct ceph_pg pgid; - int len; - int osds[]; + + union { + struct { + int len; + int osds[]; + } pg_temp; + }; }; struct ceph_osdmap { diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c index c45d235e774e..5865f2c9580a 100644 --- a/net/ceph/debugfs.c +++ b/net/ceph/debugfs.c @@ -88,9 +88,9 @@ static int osdmap_show(struct seq_file *s, void *p) seq_printf(s, "pg_temp %llu.%x [", pg->pgid.pool, pg->pgid.seed); - for (i = 0; i < pg->len; i++) + for (i = 0; i < pg->pg_temp.len; i++) seq_printf(s, "%s%d", (i == 0 ? "" : ","), - pg->osds[i]); + pg->pg_temp.osds[i]); seq_printf(s, "]\n"); } diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index ae96c73aff71..401af78ad741 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -822,9 +822,9 @@ static int __decode_pg_temp(void **p, void *end, struct ceph_osdmap *map, return -ENOMEM; pg->pgid = pgid; - pg->len = len; + pg->pg_temp.len = len; for (i = 0; i < len; i++) - pg->osds[i] = ceph_decode_32(p); + pg->pg_temp.osds[i] = ceph_decode_32(p); ret = __insert_pg_mapping(pg, &map->pg_temp); if (ret) { @@ -1275,8 +1275,8 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid, pool->pg_num_mask); pg = __lookup_pg_mapping(&osdmap->pg_temp, pgid); if (pg) { - *num = pg->len; - return pg->osds; + *num = pg->pg_temp.len; + return pg->pg_temp.osds; } /* crush */