aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph/osd_client.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-03-04 19:29:06 -0500
committerSage Weil <sage@inktank.com>2013-05-02 00:16:43 -0400
commit70636773b7c3c73677e1d653629dace7c21d14bf (patch)
treeb88e59bb77918a577f39e1a650e69464ad5716db /net/ceph/osd_client.c
parent4a73ef27ad04f1b8ea23eb55e50b20fcc0530a6f (diff)
libceph: set response data fields earlier
When an incoming message is destined for the osd client, the messenger calls the osd client's alloc_msg method. That function looks up which request has the tid matching the incoming message, and returns the request message that was preallocated to receive the response. The response message is therefore known before the request is even started. Between the start of the request and the receipt of the response, the request and its data fields will not change, so there's no reason we need to hold off setting them. In fact it's preferable to set them just once because it's more obvious that they're unchanging. So set up the fields describing where incoming data is to land in a response message at the beginning of ceph_osdc_start_request(). Define a helper function that sets these fields, and use it to set the fields for both outgoing data in the request message and incoming data in the response. This resolves: http://tracker.ceph.com/issues/4284 Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net/ceph/osd_client.c')
-rw-r--r--net/ceph/osd_client.c43
1 files changed, 20 insertions, 23 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 4402e917b9b1..37d89614a61b 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1744,32 +1744,36 @@ bad:
1744 return; 1744 return;
1745} 1745}
1746 1746
1747/* 1747static void ceph_osdc_msg_data_set(struct ceph_msg *msg,
1748 * Register request, send initial attempt. 1748 struct ceph_osd_data *osd_data)
1749 */
1750int ceph_osdc_start_request(struct ceph_osd_client *osdc,
1751 struct ceph_osd_request *req,
1752 bool nofail)
1753{ 1749{
1754 int rc = 0;
1755 struct ceph_osd_data *osd_data;
1756
1757 /* Set up outgoing data */
1758
1759 osd_data = &req->r_data_out;
1760 if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) { 1750 if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES) {
1761 BUG_ON(osd_data->length > (u64) SIZE_MAX); 1751 BUG_ON(osd_data->length > (u64) SIZE_MAX);
1762 if (osd_data->length) 1752 if (osd_data->length)
1763 ceph_msg_data_set_pages(req->r_request, 1753 ceph_msg_data_set_pages(msg, osd_data->pages,
1764 osd_data->pages, osd_data->length, 1754 osd_data->length, osd_data->alignment);
1765 osd_data->alignment);
1766#ifdef CONFIG_BLOCK 1755#ifdef CONFIG_BLOCK
1767 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) { 1756 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) {
1768 ceph_msg_data_set_bio(req->r_request, osd_data->bio); 1757 ceph_msg_data_set_bio(msg, osd_data->bio);
1769#endif 1758#endif
1770 } else { 1759 } else {
1771 BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_NONE); 1760 BUG_ON(osd_data->type != CEPH_OSD_DATA_TYPE_NONE);
1772 } 1761 }
1762}
1763
1764/*
1765 * Register request, send initial attempt.
1766 */
1767int ceph_osdc_start_request(struct ceph_osd_client *osdc,
1768 struct ceph_osd_request *req,
1769 bool nofail)
1770{
1771 int rc = 0;
1772
1773 /* Set up response incoming data and request outgoing data fields */
1774
1775 ceph_osdc_msg_data_set(req->r_reply, &req->r_data_in);
1776 ceph_osdc_msg_data_set(req->r_request, &req->r_data_out);
1773 if (req->r_trail.length) 1777 if (req->r_trail.length)
1774 ceph_msg_data_set_trail(req->r_request, &req->r_trail); 1778 ceph_msg_data_set_trail(req->r_request, &req->r_trail);
1775 1779
@@ -2130,13 +2134,6 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
2130 m = NULL; 2134 m = NULL;
2131 goto out; 2135 goto out;
2132 } 2136 }
2133 BUG_ON(osd_data->length > (u64) SIZE_MAX);
2134 ceph_msg_data_set_pages(m, osd_data->pages,
2135 osd_data->length, osd_data->alignment);
2136#ifdef CONFIG_BLOCK
2137 } else if (osd_data->type == CEPH_OSD_DATA_TYPE_BIO) {
2138 ceph_msg_data_set_bio(m, osd_data->bio);
2139#endif
2140 } 2137 }
2141 } 2138 }
2142 *skip = 0; 2139 *skip = 0;