diff mbox

cephfs: Add a function which print pg name using cephfs.

Message ID 201308051050384970885@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

majianpeng Aug. 5, 2013, 2:50 a.m. UTC
As 'cephfs map' print, it can print pgs.So add this function.

Signed-off-by: Jianpeng Ma <majianpeng@gmail.com>

---
 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 mbox

Patch

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 # */