From patchwork Mon Aug 5 02:51:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: majianpeng X-Patchwork-Id: 2838511 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 03F449F479 for ; Mon, 5 Aug 2013 02:51:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 78A002017A for ; Mon, 5 Aug 2013 02:51:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EFCB320142 for ; Mon, 5 Aug 2013 02:51:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754451Ab3HECvO (ORCPT ); Sun, 4 Aug 2013 22:51:14 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:62841 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754439Ab3HECvN (ORCPT ); Sun, 4 Aug 2013 22:51:13 -0400 Received: by mail-pa0-f52.google.com with SMTP id kq13so2693051pab.39 for ; Sun, 04 Aug 2013 19:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:reply-to:subject:x-priority:x-guid:x-has-attach :x-mailer:mime-version:message-id:content-type :content-transfer-encoding; bh=g2jc9PrOzuzsAmnSKk09o3JmvMh5k/vGLtIuz9xDeJ8=; b=MPIlirbzZPWeU5gthj7qE3JkioCZXh/VfAHO8vm859jNBfeXIBFpJGhLPL2FvXJGCM 3djOAqnjtzv861Svw20raLyIaDg1tve15f83+/XzocrFkwLyw+UecxA1BXftOG/ipUKn TzJQ9ku4ID9NRErxeUAux9+/lmfwP1wHrb8R46gEMvH9syu2vTW9+X3pwL4AYKPRm1lo sJP5grHUrvGtI5BjLj9Q4ADaUaRROqlRycHHYOH9u8L3bNT1KVtH7ezpHKGWAs5hTRaP goi2gUtLtj3UPpyVSiOrbcE2DA4QfvMZeTHu/ekN7YC4QuH7d78LuT1Hb4RV7ZPFHdv/ oqaQ== X-Received: by 10.68.164.225 with SMTP id yt1mr19471490pbb.195.1375671073207; Sun, 04 Aug 2013 19:51:13 -0700 (PDT) Received: from majianpeng ([218.242.10.182]) by mx.google.com with ESMTPSA id wr9sm24380944pbc.7.2013.08.04.19.51.09 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 04 Aug 2013 19:51:12 -0700 (PDT) Date: Mon, 5 Aug 2013 10:51:08 +0800 From: majianpeng To: sage Cc: ceph-devel Reply-To: majianpeng Subject: [PATCH 2/2] ceph: Add pg_name filed in struct ceph_ioctl_dataloc. X-Priority: 3 X-GUID: 4BF9237B-6315-4C8F-92D0-E92289E6132B X-Has-Attach: no X-Mailer: Foxmail 7.0.1.90[en] Mime-Version: 1.0 Message-ID: <201308051051060248738@gmail.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=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 As the 'ceph help' print, it will print pgs.But now it can't. So we add this.There are two type name of pg, temp and stable. Because the command 'ceph pg dump' print temp name,so we also print the temp name of pg. Signed-off-by: Jianpeng Ma --- fs/ceph/ioctl.c | 10 +++++++++- fs/ceph/ioctl.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) -- 1.8.3.rc1.44.gb387c77 Thanks! Jianpeng Ma diff --git a/fs/ceph/ioctl.c b/fs/ceph/ioctl.c index e0b4ef3..1d0f24c 100644 --- a/fs/ceph/ioctl.c +++ b/fs/ceph/ioctl.c @@ -209,9 +209,17 @@ static long ceph_ioctl_get_dataloc(struct file *file, void __user *arg) snprintf(dl.object_name, sizeof(dl.object_name), "%llx.%08llx", ceph_ino(inode), dl.object_no); + r = ceph_calc_ceph_temp_pg(&pgid, dl.object_name, osdc->osdmap, + ceph_file_layout_pg_pool(ci->i_layout)); + if (r < 0) { + down_read(&osdc->map_sem); + return r; + } + snprintf(dl.pg_name, sizeof(dl.pg_name), "%llx.%08x", + pgid.pool, pgid.seed); + ceph_calc_ceph_pg(&pgid, dl.object_name, osdc->osdmap, ceph_file_layout_pg_pool(ci->i_layout)); - dl.osd = ceph_calc_pg_primary(osdc->osdmap, pgid); if (dl.osd >= 0) { struct ceph_entity_addr *a = diff --git a/fs/ceph/ioctl.h b/fs/ceph/ioctl.h index c77028a..618eef2 100644 --- a/fs/ceph/ioctl.h +++ b/fs/ceph/ioctl.h @@ -58,6 +58,7 @@ struct ceph_ioctl_dataloc { __u64 object_no; /* out: object # */ __u64 object_size; /* out: object size */ char object_name[64]; /* out: object name */ + char pg_name[32]; /* out: pg name*/ __u64 block_offset; /* out: offset in block */ __u64 block_size; /* out: block length */ __s64 osd; /* out: osd # */