diff options
author | Yehuda Sadeh <yehuda@hq.newdream.net> | 2010-01-08 16:58:34 -0500 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-01-25 15:57:37 -0500 |
commit | 2450418c47b7998ad55a73f23707b1e21c371eef (patch) | |
tree | 1e17dd88f86c5daa1bfbca1aeea0c909391b5829 /fs/ceph/osd_client.c | |
parent | 5b1daecd59f95eb24dc629407ed80369c9929520 (diff) |
ceph: allocate middle of message before stating to read
Both front and middle parts of the message are now being
allocated at the ceph_alloc_msg().
Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Diffstat (limited to 'fs/ceph/osd_client.c')
-rw-r--r-- | fs/ceph/osd_client.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/ceph/osd_client.c b/fs/ceph/osd_client.c index 8417e21a3cb2..545e93617993 100644 --- a/fs/ceph/osd_client.c +++ b/fs/ceph/osd_client.c | |||
@@ -1304,18 +1304,28 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg) | |||
1304 | } | 1304 | } |
1305 | 1305 | ||
1306 | static struct ceph_msg *alloc_msg(struct ceph_connection *con, | 1306 | static struct ceph_msg *alloc_msg(struct ceph_connection *con, |
1307 | struct ceph_msg_header *hdr) | 1307 | struct ceph_msg_header *hdr, |
1308 | int *skip) | ||
1308 | { | 1309 | { |
1309 | struct ceph_osd *osd = con->private; | 1310 | struct ceph_osd *osd = con->private; |
1310 | struct ceph_osd_client *osdc = osd->o_osdc; | 1311 | struct ceph_osd_client *osdc = osd->o_osdc; |
1311 | int type = le16_to_cpu(hdr->type); | 1312 | int type = le16_to_cpu(hdr->type); |
1312 | int front = le32_to_cpu(hdr->front_len); | 1313 | int front = le32_to_cpu(hdr->front_len); |
1314 | struct ceph_msg *m; | ||
1313 | 1315 | ||
1316 | *skip = 0; | ||
1314 | switch (type) { | 1317 | switch (type) { |
1315 | case CEPH_MSG_OSD_OPREPLY: | 1318 | case CEPH_MSG_OSD_OPREPLY: |
1316 | return ceph_msgpool_get(&osdc->msgpool_op_reply, front); | 1319 | m = ceph_msgpool_get(&osdc->msgpool_op_reply, front); |
1320 | break; | ||
1321 | default: | ||
1322 | return NULL; | ||
1317 | } | 1323 | } |
1318 | return ceph_alloc_msg(con, hdr); | 1324 | |
1325 | if (!m) | ||
1326 | *skip = 1; | ||
1327 | |||
1328 | return m; | ||
1319 | } | 1329 | } |
1320 | 1330 | ||
1321 | /* | 1331 | /* |
@@ -1390,6 +1400,5 @@ const static struct ceph_connection_operations osd_con_ops = { | |||
1390 | .verify_authorizer_reply = verify_authorizer_reply, | 1400 | .verify_authorizer_reply = verify_authorizer_reply, |
1391 | .alloc_msg = alloc_msg, | 1401 | .alloc_msg = alloc_msg, |
1392 | .fault = osd_reset, | 1402 | .fault = osd_reset, |
1393 | .alloc_middle = ceph_alloc_middle, | ||
1394 | .prepare_pages = prepare_pages, | 1403 | .prepare_pages = prepare_pages, |
1395 | }; | 1404 | }; |