From patchwork Mon Aug 5 02:50:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: majianpeng X-Patchwork-Id: 2838509 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 95DFA9F479 for ; Mon, 5 Aug 2013 02:50:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 12E382017A for ; Mon, 5 Aug 2013 02:50:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 853FC20142 for ; Mon, 5 Aug 2013 02:50:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754299Ab3HECur (ORCPT ); Sun, 4 Aug 2013 22:50:47 -0400 Received: from mail-pb0-f51.google.com ([209.85.160.51]:37810 "EHLO mail-pb0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754276Ab3HECuq (ORCPT ); Sun, 4 Aug 2013 22:50:46 -0400 Received: by mail-pb0-f51.google.com with SMTP id jt11so2772645pbb.24 for ; Sun, 04 Aug 2013 19:50:46 -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=o5YKCxH7SUjPGRSbo0kLkU+BdRx3Bmeu8zN0i0cTPR4=; b=SuVBNavcVP3Z05ICvoFOJaoki+/2svNuBL9omuczqHsX9rZcdXv/xPR5RVRXS805qQ rr42xrc/3enj1ue2wsBWe5BRtJR/oCEm1ed5Pi0Hs5CcuDfImQyhfuTUA0NqIyO6qSqt hTCXXbc3kPxBi6ruZza1bDL0k/3GawYEafzGFipxFypVssxPs8be7rlgeIZRGCV8DIl0 JIpdXRDx2IGkeSxR5EkE7vHXH20gwnKWpmR0QkBv/Ob/Lxk7y+lfniJAFMF538X+9cZ9 Cd8zcDeJhQyFONJ/tXNHYkh1Qg70mu+p7vAxDrtlX46JS6dyKgjULCgG4CLdRO9WKDBs 6QgA== X-Received: by 10.66.252.234 with SMTP id zv10mr22706463pac.186.1375671046107; Sun, 04 Aug 2013 19:50:46 -0700 (PDT) Received: from majianpeng ([218.242.10.182]) by mx.google.com with ESMTPSA id bt1sm24384525pbb.2.2013.08.04.19.50.42 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 04 Aug 2013 19:50:45 -0700 (PDT) Date: Mon, 5 Aug 2013 10:50:40 +0800 From: majianpeng To: sage Cc: ceph-devel Reply-To: majianpeng Subject: [PATCH] cephfs: Add a function which print pg name using cephfs. X-Priority: 3 X-GUID: 777D39E5-4C0E-4A43-98F4-A09B6C41552D X-Has-Attach: no X-Mailer: Foxmail 7.0.1.90[en] Mime-Version: 1.0 Message-ID: <201308051050384970885@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 'cephfs map' print, it can print pgs.So add this function. Signed-off-by: Jianpeng Ma --- src/cephfs.cc | 9 +++++---- src/client/ioctl.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) -- 1.8.3.rc1.44.gb387c77 Thanks! Jianpeng Ma diff --git a/src/cephfs.cc b/src/cephfs.cc index f25d02a..aaa6ad4 100644 --- a/src/cephfs.cc +++ b/src/cephfs.cc @@ -91,6 +91,7 @@ int main (int argc, char **argv) { cout << "location.object_no: " << location.object_no << endl; cout << "location.object_size: " << location.object_size << endl; cout << "location.object_name: " << location.object_name << endl; + cout << "location.pg_name: " << location.pg_name << endl; cout << "location.block_offset: " << location.block_offset << endl; cout << "location.block_size: " << location.block_size << endl; cout << "location.osd: " << location.osd << endl; @@ -128,8 +129,8 @@ int main (int argc, char **argv) { return 1; } - printf("%15s %24s %12s %12s %s\n", - "FILE OFFSET", "OBJECT", "OFFSET", "LENGTH", "OSD"); + printf("%15s %24s %12s %12s %12s %s\n", + "FILE OFFSET", "OBJECT", "PG", "OFFSET", "LENGTH", "OSD"); for (long long off = 0; off < st.st_size; off += layout.stripe_unit) { struct ceph_ioctl_dataloc location; @@ -140,8 +141,8 @@ int main (int argc, char **argv) { << (err == -1 ? strerror(errno) : strerror(-err)) << endl; return 1; } - printf("%15lld %24s %12lld %12lld %d\n", - off, location.object_name, (long long)location.object_offset, + printf("%15lld %24s %12s %12lld %12lld %3d\n", + off, location.object_name, location.pg_name, (long long)location.object_offset, (long long)location.block_size, (int)location.osd); } diff --git a/src/client/ioctl.h b/src/client/ioctl.h index c15d334..963ee84 100644 --- a/src/client/ioctl.h +++ b/src/client/ioctl.h @@ -36,6 +36,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 # */