All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@inktank.com>
To: "ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>
Subject: [PATCH 2/3] libceph: format target object name in caller
Date: Mon, 25 Feb 2013 17:12:15 -0600	[thread overview]
Message-ID: <512BEFCF.80408@inktank.com> (raw)
In-Reply-To: <512BEF26.3030207@inktank.com>

Move the formatting of the object name (oid) to use for an object
request into the caller of calc_layout().  This makes the "vino"
parameter no longer necessary, so get rid of it.

Signed-off-by: Alex Elder <elder@inktank.com>
---
 net/ceph/osd_client.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index fcc783b..4f90c24 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -63,9 +63,7 @@ static int op_has_extent(int op)
  *
  * fill osd op in request message.
  */
-static int calc_layout(struct ceph_vino vino,
-		       struct ceph_file_layout *layout,
-		       u64 off, u64 *plen,
+static int calc_layout(struct ceph_file_layout *layout, u64 off, u64 *plen,
 		       struct ceph_osd_request *req,
 		       struct ceph_osd_req_op *op, u64 *bno)
 {
@@ -105,9 +103,6 @@ static int calc_layout(struct ceph_vino vino,
 	dout("calc_layout bno=%llx %llu~%llu (%d pages)\n",
 	     *bno, objoff, objlen, req->r_num_pages);

-	snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, *bno);
-	req->r_oid_len = strlen(req->r_oid);
-
 	return 0;
 }

@@ -436,7 +431,7 @@ struct ceph_osd_request
*ceph_osdc_new_request(struct ceph_osd_client *osdc,
 	req->r_flags = flags;

 	/* calculate max write size */
-	r = calc_layout(vino, layout, off, plen, req, ops, &bno);
+	r = calc_layout(layout, off, plen, req, ops, &bno);
 	if (r < 0) {
 		ceph_osdc_put_request(req);
 		return ERR_PTR(r);
@@ -444,6 +439,9 @@ struct ceph_osd_request
*ceph_osdc_new_request(struct ceph_osd_client *osdc,

 	req->r_file_layout = *layout;  /* keep a copy */

+	snprintf(req->r_oid, sizeof(req->r_oid), "%llx.%08llx", vino.ino, bno);
+	req->r_oid_len = strlen(req->r_oid);
+
 	/* in case it differs from natural (file) alignment that
 	   calc_layout filled in for us */
 	req->r_num_pages = calc_pages_for(page_align, *plen);
-- 
1.7.9.5


  parent reply	other threads:[~2013-02-25 23:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25 23:09 [PATCH 0/3] libceph: focus calc_layout() on filling in the osd op Alex Elder
2013-02-25 23:12 ` [PATCH 1/3] libceph: pass object number back to calc_layout() caller Alex Elder
2013-02-25 23:12 ` Alex Elder [this message]
2013-02-25 23:12 ` [PATCH 3/3] libceph: don't pass request to calc_layout() Alex Elder
2013-02-26 18:20 ` [PATCH 0/3] libceph: focus calc_layout() on filling in the osd op Josh Durgin

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=512BEFCF.80408@inktank.com \
    --to=elder@inktank.com \
    --cc=ceph-devel@vger.kernel.org \
    /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.