aboutsummaryrefslogtreecommitdiff
path: root/fs/ceph/mon_client.c
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2010-01-08 13:58:34 -0800
committerSage Weil <sage@newdream.net>2010-01-25 12:57:37 -0800
commit2450418c47b7998ad55a73f23707b1e21c371eef (patch)
tree1e17dd88f86c5daa1bfbca1aeea0c909391b5829 /fs/ceph/mon_client.c
parent5b1daecd59f95eb24dc629407ed80369c9929520 (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/mon_client.c')
-rw-r--r--fs/ceph/mon_client.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c
index 223e8bc207e..6c00b37cc55 100644
--- a/fs/ceph/mon_client.c
+++ b/fs/ceph/mon_client.c
@@ -692,21 +692,33 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg)
* Allocate memory for incoming message
*/
static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con,
- struct ceph_msg_header *hdr)
+ struct ceph_msg_header *hdr,
+ int *skip)
{
struct ceph_mon_client *monc = con->private;
int type = le16_to_cpu(hdr->type);
- int front = le32_to_cpu(hdr->front_len);
+ int front_len = le32_to_cpu(hdr->front_len);
+ struct ceph_msg *m;
+ *skip = 0;
switch (type) {
case CEPH_MSG_MON_SUBSCRIBE_ACK:
- return ceph_msgpool_get(&monc->msgpool_subscribe_ack, front);
+ m = ceph_msgpool_get(&monc->msgpool_subscribe_ack, front_len);
+ break;
case CEPH_MSG_STATFS_REPLY:
- return ceph_msgpool_get(&monc->msgpool_statfs_reply, front);
+ m = ceph_msgpool_get(&monc->msgpool_statfs_reply, front_len);
+ break;
case CEPH_MSG_AUTH_REPLY:
- return ceph_msgpool_get(&monc->msgpool_auth_reply, front);
+ m = ceph_msgpool_get(&monc->msgpool_auth_reply, front_len);
+ break;
+ default:
+ return NULL;
}
- return ceph_alloc_msg(con, hdr);
+
+ if (!m)
+ *skip = 1;
+
+ return m;
}
/*
@@ -749,5 +761,4 @@ const static struct ceph_connection_operations mon_con_ops = {
.dispatch = dispatch,
.fault = mon_fault,
.alloc_msg = mon_alloc_msg,
- .alloc_middle = ceph_alloc_middle,
};