From: Alex Elder <elder@inktank.com>
To: "ceph-devel@vger.kernel.org" <ceph-devel@vger.kernel.org>
Subject: [PATCH 4/9] libceph: record message data length
Date: Thu, 04 Apr 2013 11:19:04 -0500 [thread overview]
Message-ID: <515DA7F8.7030508@inktank.com> (raw)
In-Reply-To: <515DA755.2090504@inktank.com>
Keep track of the length of the data portion for a message in a
separate field in the ceph_msg structure. This information has
been maintained in wire byte order in the message header, but
that's going to change soon.
Signed-off-by: Alex Elder <elder@inktank.com>
---
include/linux/ceph/messenger.h | 4 +++-
net/ceph/messenger.c | 9 ++++++++-
net/ceph/osd_client.c | 2 +-
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h
index 3181321..b832c0c 100644
--- a/include/linux/ceph/messenger.h
+++ b/include/linux/ceph/messenger.h
@@ -139,6 +139,7 @@ struct ceph_msg {
struct kvec front; /* unaligned blobs of message */
struct ceph_buffer *middle;
+ size_t data_length;
struct ceph_msg_data *data; /* data payload */
struct ceph_connection *con;
@@ -270,7 +271,8 @@ extern void ceph_msg_data_set_pages(struct ceph_msg
*msg, struct page **pages,
size_t length, size_t alignment);
extern void ceph_msg_data_set_pagelist(struct ceph_msg *msg,
struct ceph_pagelist *pagelist);
-extern void ceph_msg_data_set_bio(struct ceph_msg *msg, struct bio *bio);
+extern void ceph_msg_data_set_bio(struct ceph_msg *msg, struct bio *bio,
+ size_t length);
extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
bool can_fail);
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index ee16086..7812c33 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2981,6 +2981,7 @@ void ceph_msg_data_set_pages(struct ceph_msg *msg,
struct page **pages,
BUG_ON(!pages);
BUG_ON(!length);
+ BUG_ON(msg->data_length);
BUG_ON(msg->data != NULL);
data = ceph_msg_data_create(CEPH_MSG_DATA_PAGES);
@@ -2990,6 +2991,7 @@ void ceph_msg_data_set_pages(struct ceph_msg *msg,
struct page **pages,
data->alignment = alignment & ~PAGE_MASK;
msg->data = data;
+ msg->data_length = length;
}
EXPORT_SYMBOL(ceph_msg_data_set_pages);
@@ -3000,6 +3002,7 @@ void ceph_msg_data_set_pagelist(struct ceph_msg *msg,
BUG_ON(!pagelist);
BUG_ON(!pagelist->length);
+ BUG_ON(msg->data_length);
BUG_ON(msg->data != NULL);
data = ceph_msg_data_create(CEPH_MSG_DATA_PAGELIST);
@@ -3007,14 +3010,17 @@ void ceph_msg_data_set_pagelist(struct ceph_msg
*msg,
data->pagelist = pagelist;
msg->data = data;
+ msg->data_length = pagelist->length;
}
EXPORT_SYMBOL(ceph_msg_data_set_pagelist);
-void ceph_msg_data_set_bio(struct ceph_msg *msg, struct bio *bio)
+void ceph_msg_data_set_bio(struct ceph_msg *msg, struct bio *bio,
+ size_t length)
{
struct ceph_msg_data *data;
BUG_ON(!bio);
+ BUG_ON(msg->data_length);
BUG_ON(msg->data != NULL);
data = ceph_msg_data_create(CEPH_MSG_DATA_BIO);
@@ -3022,6 +3028,7 @@ void ceph_msg_data_set_bio(struct ceph_msg *msg,
struct bio *bio)
data->bio = bio;
msg->data = data;
+ msg->data_length = length;
}
EXPORT_SYMBOL(ceph_msg_data_set_bio);
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index e088792..0b4951e 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1848,7 +1848,7 @@ static void ceph_osdc_msg_data_set(struct ceph_msg
*msg,
ceph_msg_data_set_pagelist(msg, osd_data->pagelist);
#ifdef CONFIG_BLOCK
} else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) {
- ceph_msg_data_set_bio(msg, osd_data->bio);
+ ceph_msg_data_set_bio(msg, osd_data->bio, osd_data->bio_length);
#endif
} else {
BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_NONE);
--
1.7.9.5
next prev parent reply other threads:[~2013-04-04 16:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-04 16:16 [PATCH 0/9] Alex Elder
2013-04-04 16:18 ` [PATCH 1/9] ceph: use page_offset() in ceph_writepages_start() Alex Elder
2013-04-04 16:18 ` [PATCH 2/9] libceph: drop ceph_osd_request->r_con_filling_msg Alex Elder
2013-04-04 16:18 ` [PATCH 3/9] libceph: record length of bio list with bio Alex Elder
2013-04-04 16:19 ` Alex Elder [this message]
2013-04-04 18:34 ` [PATCH 4/9, v2] libceph: record message data length Alex Elder
2013-04-04 16:19 ` [PATCH 5/9] libceph: don't build request in ceph_osdc_new_request() Alex Elder
2013-04-04 16:19 ` [PATCH 6/9] ceph: define ceph_writepages_osd_request() Alex Elder
2013-04-04 16:19 ` [PATCH 7/9] ceph: kill ceph alloc_page_vec() Alex Elder
2013-04-04 16:20 ` [PATCH 8/9] libceph: hold off building osd request Alex Elder
2013-04-04 16:20 ` [PATCH 9/9] ceph: build osd request message later for writepages Alex Elder
2013-04-05 3:03 ` [PATCH 0/9] Josh Durgin
2013-04-05 12:09 ` Alex Elder
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=515DA7F8.7030508@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.