All of lore.kernel.org
 help / color / mirror / Atom feed
From: majianpeng <majianpeng@gmail.com>
To: sage <sage@inktank.com>
Cc: ceph-devel <ceph-devel@vger.kernel.org>
Subject: [PATCH 2/2] ceph: Add pg_name filed in struct ceph_ioctl_dataloc.
Date: Mon, 5 Aug 2013 10:51:08 +0800	[thread overview]
Message-ID: <201308051051060248738@gmail.com> (raw)

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 <majianpeng@gmail.com>
---
 fs/ceph/ioctl.c | 10 +++++++++-
 fs/ceph/ioctl.h |  1 +
 2 files changed, 10 insertions(+), 1 deletion(-)

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 # */
-- 
1.8.3.rc1.44.gb387c77


Thanks!
Jianpeng Ma

             reply	other threads:[~2013-08-05  2:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05  2:51 majianpeng [this message]
2013-08-05  4:24 ` [PATCH 2/2] ceph: Add pg_name filed in struct ceph_ioctl_dataloc Sage Weil
2013-08-05  5:27   ` majianpeng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201308051051060248738@gmail.com \
    --to=majianpeng@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=sage@inktank.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.