aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-02-14 13:16:43 -0500
committerSage Weil <sage@inktank.com>2013-05-02 00:16:38 -0400
commit02afca6ca00b7972887c5cc77068356f33bdfc18 (patch)
treea335532b314d8da309bb7313cc84ae973d3f5ab0 /net
parente0c594878e3211b09208c779df5f996f0b831d9e (diff)
libceph: isolate message page field manipulation
Define a function ceph_msg_data_set_pages(), which more clearly abstracts the assignment page-related fields for data in a ceph message structure. Use this new function in the osd client and mds client. Ideally, these fields would never be set more than once (with BUG_ON() calls to guarantee that). At the moment though the osd client sets these every time it receives a message, and in the event of a communication problem this can happen more than once. (This will be resolved shortly, but setting up these helpers first makes it all a bit easier to work with.) Rearrange the field order in a ceph_msg structure to group those that are used to define the possible data payloads. This partially resolves: http://tracker.ceph.com/issues/4263 Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/messenger.c11
-rw-r--r--net/ceph/osd_client.c10
2 files changed, 15 insertions, 6 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index ce1669f75ca5..cec39cb623f0 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -2689,6 +2689,17 @@ void ceph_con_keepalive(struct ceph_connection *con)
2689} 2689}
2690EXPORT_SYMBOL(ceph_con_keepalive); 2690EXPORT_SYMBOL(ceph_con_keepalive);
2691 2691
2692void ceph_msg_data_set_pages(struct ceph_msg *msg, struct page **pages,
2693 unsigned int page_count, size_t alignment)
2694{
2695 /* BUG_ON(msg->pages); */
2696 /* BUG_ON(msg->page_count); */
2697
2698 msg->pages = pages;
2699 msg->page_count = page_count;
2700 msg->page_alignment = alignment & ~PAGE_MASK;
2701}
2702EXPORT_SYMBOL(ceph_msg_data_set_pages);
2692 2703
2693/* 2704/*
2694 * construct a new message with given type, size 2705 * construct a new message with given type, size
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 202af14dc6dc..a09d57134075 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1760,11 +1760,10 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
1760 if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) { 1760 if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) {
1761 unsigned int page_count; 1761 unsigned int page_count;
1762 1762
1763 req->r_request->pages = osd_data->pages;
1764 page_count = calc_pages_for((u64)osd_data->alignment, 1763 page_count = calc_pages_for((u64)osd_data->alignment,
1765 (u64)osd_data->length); 1764 (u64)osd_data->length);
1766 req->r_request->page_count = page_count; 1765 ceph_msg_data_set_pages(req->r_request, osd_data->pages,
1767 req->r_request->page_alignment = osd_data->alignment; 1766 page_count, osd_data->alignment);
1768#ifdef CONFIG_BLOCK 1767#ifdef CONFIG_BLOCK
1769 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) { 1768 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) {
1770 req->r_request->bio = osd_data->bio; 1769 req->r_request->bio = osd_data->bio;
@@ -2135,9 +2134,8 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
2135 } 2134 }
2136 page_count = calc_pages_for((u64)osd_data->alignment, 2135 page_count = calc_pages_for((u64)osd_data->alignment,
2137 (u64)osd_data->length); 2136 (u64)osd_data->length);
2138 m->pages = osd_data->pages; 2137 ceph_msg_data_set_pages(m, osd_data->pages,
2139 m->page_count = page_count; 2138 osd_data->num_pages, osd_data->alignment);
2140 m->page_alignment = osd_data->alignment;
2141#ifdef CONFIG_BLOCK 2139#ifdef CONFIG_BLOCK
2142 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) { 2140 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) {
2143 m->bio = osd_data->bio; 2141 m->bio = osd_data->bio;