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 16/20] libceph: move ceph_osdc_build_request()
Date: Fri, 05 Apr 2013 09:05:18 -0500	[thread overview]
Message-ID: <515EDA1E.7080300@inktank.com> (raw)
In-Reply-To: <515ED849.9060901@inktank.com>

This simply moves ceph_osdc_build_request() later in its source
file without any change.  Done as a separate patch to facilitate
review of the change in the next patch.

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

diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 6c6d7b8..f80984e 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -526,104 +526,6 @@ static u64 osd_req_encode_op(struct
ceph_osd_request *req,
 }

 /*
- * build new request AND message
- *
- */
-void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off,
-				struct ceph_snap_context *snapc, u64 snap_id,
-				struct timespec *mtime)
-{
-	struct ceph_msg *msg = req->r_request;
-	void *p;
-	size_t msg_size;
-	int flags = req->r_flags;
-	u64 data_len;
-	unsigned int i;
-
-	req->r_snapid = snap_id;
-	req->r_snapc = ceph_get_snap_context(snapc);
-
-	/* encode request */
-	msg->hdr.version = cpu_to_le16(4);
-
-	p = msg->front.iov_base;
-	ceph_encode_32(&p, 1);   /* client_inc  is always 1 */
-	req->r_request_osdmap_epoch = p;
-	p += 4;
-	req->r_request_flags = p;
-	p += 4;
-	if (req->r_flags & CEPH_OSD_FLAG_WRITE)
-		ceph_encode_timespec(p, mtime);
-	p += sizeof(struct ceph_timespec);
-	req->r_request_reassert_version = p;
-	p += sizeof(struct ceph_eversion); /* will get filled in */
-
-	/* oloc */
-	ceph_encode_8(&p, 4);
-	ceph_encode_8(&p, 4);
-	ceph_encode_32(&p, 8 + 4 + 4);
-	req->r_request_pool = p;
-	p += 8;
-	ceph_encode_32(&p, -1);  /* preferred */
-	ceph_encode_32(&p, 0);   /* key len */
-
-	ceph_encode_8(&p, 1);
-	req->r_request_pgid = p;
-	p += 8 + 4;
-	ceph_encode_32(&p, -1);  /* preferred */
-
-	/* oid */
-	ceph_encode_32(&p, req->r_oid_len);
-	memcpy(p, req->r_oid, req->r_oid_len);
-	dout("oid '%.*s' len %d\n", req->r_oid_len, req->r_oid, req->r_oid_len);
-	p += req->r_oid_len;
-
-	/* ops--can imply data */
-	ceph_encode_16(&p, (u16)req->r_num_ops);
-	data_len = 0;
-	for (i = 0; i < req->r_num_ops; i++) {
-		data_len += osd_req_encode_op(req, p, i);
-		p += sizeof(struct ceph_osd_op);
-	}
-
-	/* snaps */
-	ceph_encode_64(&p, req->r_snapid);
-	ceph_encode_64(&p, req->r_snapc ? req->r_snapc->seq : 0);
-	ceph_encode_32(&p, req->r_snapc ? req->r_snapc->num_snaps : 0);
-	if (req->r_snapc) {
-		for (i = 0; i < snapc->num_snaps; i++) {
-			ceph_encode_64(&p, req->r_snapc->snaps[i]);
-		}
-	}
-
-	req->r_request_attempts = p;
-	p += 4;
-
-	/* data */
-	if (flags & CEPH_OSD_FLAG_WRITE) {
-		u16 data_off;
-
-		/*
-		 * The header "data_off" is a hint to the receiver
-		 * allowing it to align received data into its
-		 * buffers such that there's no need to re-copy
-		 * it before writing it to disk (direct I/O).
-		 */
-		data_off = (u16) (off & 0xffff);
-		req->r_request->hdr.data_off = cpu_to_le16(data_off);
-	}
-	req->r_request->hdr.data_len = cpu_to_le32(data_len);
-
-	BUG_ON(p > msg->front.iov_base + msg->front.iov_len);
-	msg_size = p - msg->front.iov_base;
-	msg->front.iov_len = msg_size;
-	msg->hdr.front_len = cpu_to_le32(msg_size);
-
-	dout("build_request msg_size was %d\n", (int)msg_size);
-}
-EXPORT_SYMBOL(ceph_osdc_build_request);
-
-/*
  * build new request AND message, calculate layout, and adjust file
  * extent as needed.
  *
@@ -1968,6 +1870,104 @@ static void ceph_osdc_msg_data_set(struct
ceph_msg *msg,
 }

 /*
+ * build new request AND message
+ *
+ */
+void ceph_osdc_build_request(struct ceph_osd_request *req, u64 off,
+				struct ceph_snap_context *snapc, u64 snap_id,
+				struct timespec *mtime)
+{
+	struct ceph_msg *msg = req->r_request;
+	void *p;
+	size_t msg_size;
+	int flags = req->r_flags;
+	u64 data_len;
+	unsigned int i;
+
+	req->r_snapid = snap_id;
+	req->r_snapc = ceph_get_snap_context(snapc);
+
+	/* encode request */
+	msg->hdr.version = cpu_to_le16(4);
+
+	p = msg->front.iov_base;
+	ceph_encode_32(&p, 1);   /* client_inc  is always 1 */
+	req->r_request_osdmap_epoch = p;
+	p += 4;
+	req->r_request_flags = p;
+	p += 4;
+	if (req->r_flags & CEPH_OSD_FLAG_WRITE)
+		ceph_encode_timespec(p, mtime);
+	p += sizeof(struct ceph_timespec);
+	req->r_request_reassert_version = p;
+	p += sizeof(struct ceph_eversion); /* will get filled in */
+
+	/* oloc */
+	ceph_encode_8(&p, 4);
+	ceph_encode_8(&p, 4);
+	ceph_encode_32(&p, 8 + 4 + 4);
+	req->r_request_pool = p;
+	p += 8;
+	ceph_encode_32(&p, -1);  /* preferred */
+	ceph_encode_32(&p, 0);   /* key len */
+
+	ceph_encode_8(&p, 1);
+	req->r_request_pgid = p;
+	p += 8 + 4;
+	ceph_encode_32(&p, -1);  /* preferred */
+
+	/* oid */
+	ceph_encode_32(&p, req->r_oid_len);
+	memcpy(p, req->r_oid, req->r_oid_len);
+	dout("oid '%.*s' len %d\n", req->r_oid_len, req->r_oid, req->r_oid_len);
+	p += req->r_oid_len;
+
+	/* ops--can imply data */
+	ceph_encode_16(&p, (u16)req->r_num_ops);
+	data_len = 0;
+	for (i = 0; i < req->r_num_ops; i++) {
+		data_len += osd_req_encode_op(req, p, i);
+		p += sizeof(struct ceph_osd_op);
+	}
+
+	/* snaps */
+	ceph_encode_64(&p, req->r_snapid);
+	ceph_encode_64(&p, req->r_snapc ? req->r_snapc->seq : 0);
+	ceph_encode_32(&p, req->r_snapc ? req->r_snapc->num_snaps : 0);
+	if (req->r_snapc) {
+		for (i = 0; i < snapc->num_snaps; i++) {
+			ceph_encode_64(&p, req->r_snapc->snaps[i]);
+		}
+	}
+
+	req->r_request_attempts = p;
+	p += 4;
+
+	/* data */
+	if (flags & CEPH_OSD_FLAG_WRITE) {
+		u16 data_off;
+
+		/*
+		 * The header "data_off" is a hint to the receiver
+		 * allowing it to align received data into its
+		 * buffers such that there's no need to re-copy
+		 * it before writing it to disk (direct I/O).
+		 */
+		data_off = (u16) (off & 0xffff);
+		req->r_request->hdr.data_off = cpu_to_le16(data_off);
+	}
+	req->r_request->hdr.data_len = cpu_to_le32(data_len);
+
+	BUG_ON(p > msg->front.iov_base + msg->front.iov_len);
+	msg_size = p - msg->front.iov_base;
+	msg->front.iov_len = msg_size;
+	msg->hdr.front_len = cpu_to_le32(msg_size);
+
+	dout("build_request msg_size was %d\n", (int)msg_size);
+}
+EXPORT_SYMBOL(ceph_osdc_build_request);
+
+/*
  * Register request, send initial attempt.
  */
 int ceph_osdc_start_request(struct ceph_osd_client *osdc,
-- 
1.7.9.5


  parent reply	other threads:[~2013-04-05 14:05 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-05 13:57 [PATCH 00/20] libceph: per-op osd request data Alex Elder
2013-04-05 14:01 ` [PATCH 01/20] rbd: define inbound data size for method ops Alex Elder
2013-04-05 18:13   ` Josh Durgin
2013-04-05 14:01 ` [PATCH 02/20] libceph: compute incoming bytes once Alex Elder
2013-04-05 18:14   ` Josh Durgin
2013-04-05 14:02 ` [PATCH 03/20] libceph: define osd data initialization helpers Alex Elder
2013-04-05 18:16   ` Josh Durgin
2013-04-05 14:02 ` [PATCH 04/20] libceph: define a few more helpers Alex Elder
2013-04-05 18:17   ` Josh Durgin
2013-04-05 14:02 ` [PATCH 05/20] libceph: define ceph_osd_data_length() Alex Elder
2013-04-05 18:17   ` Josh Durgin
2013-04-05 14:02 ` [PATCH 06/20] libceph: a few more osd data cleanups Alex Elder
2013-04-05 18:17   ` Josh Durgin
2013-04-05 14:03 ` [PATCH 07/20] rbd: define rbd_osd_req_format_op() Alex Elder
2013-04-05 18:18   ` Josh Durgin
2013-04-05 14:03 ` [PATCH 08/20] libceph: keep source rather than message osd op array Alex Elder
2013-04-08 18:12   ` Josh Durgin
2013-04-05 14:03 ` [PATCH 09/20] libceph: rename data out field in osd request op Alex Elder
2013-04-08 18:12   ` Josh Durgin
2013-04-05 14:03 ` [PATCH 10/20] libceph: add data pointers in osd op structures Alex Elder
2013-04-08 18:13   ` Josh Durgin
2013-04-05 14:04 ` [PATCH 11/20] libceph: specify osd op by index in request Alex Elder
2013-04-08 18:14   ` Josh Durgin
2013-04-05 14:04 ` [PATCH 12/20] rbd: don't set data in rbd_osd_req_format_op() Alex Elder
2013-04-08 18:14   ` Josh Durgin
2013-04-05 14:04 ` [PATCH 13/20] rbd: separate initialization of osd data Alex Elder
2013-04-08 18:14   ` Josh Durgin
2013-04-05 14:04 ` [PATCH 14/20] rbd: rearrange some code for consistency Alex Elder
2013-04-08 18:15   ` Josh Durgin
2013-04-05 14:05 ` [PATCH 15/20] libceph: format class info at init time Alex Elder
2013-04-08 18:16   ` Josh Durgin
2013-04-05 14:05 ` Alex Elder [this message]
2013-04-08 18:17   ` [PATCH 16/20] libceph: move ceph_osdc_build_request() Josh Durgin
2013-04-05 14:05 ` [PATCH 17/20] libceph: set message data when building osd request Alex Elder
2013-04-08 18:17   ` Josh Durgin
2013-04-05 14:05 ` [PATCH 18/20] libceph: combine initializing and setting osd data Alex Elder
2013-04-08 19:59   ` Josh Durgin
2013-04-05 14:06 ` [PATCH 19/20] libceph: set the data pointers when encoding ops Alex Elder
2013-04-08 20:03   ` Josh Durgin
2013-04-05 14:06 ` [PATCH 20/20] libceph: kill off osd request r_data_in and r_data_out Alex Elder
2013-04-08 20:07   ` 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=515EDA1E.7080300@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.