summaryrefslogtreecommitdiffstats
path: root/fs/ceph/messenger.c
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2010-01-11 14:47:13 -0800
committerSage Weil <sage@newdream.net>2010-01-25 12:57:46 -0800
commit0547a9b30a5ac8680325752b61d3ffa9d4971b6e (patch)
tree0e54e227d44fab7b98c97ee4c3bed185a1238487 /fs/ceph/messenger.c
parent9d7f0f139edfdce1a1539b100c617fd9182b0829 (diff)
downloadblackbird-op-linux-0547a9b30a5ac8680325752b61d3ffa9d4971b6e.tar.gz
blackbird-op-linux-0547a9b30a5ac8680325752b61d3ffa9d4971b6e.zip
ceph: alloc message data pages and check if tid exists
Now doing it in the same callback that is also responsible for allocating the 'front' part of the message. If we get a message that we haven't got a corresponding tid for, mark it for skipping. Moving the mutex unlock/lock from the osd alloc_msg callback to the calling function in the messenger. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Diffstat (limited to 'fs/ceph/messenger.c')
-rw-r--r--fs/ceph/messenger.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/fs/ceph/messenger.c b/fs/ceph/messenger.c
index e8742cc9ecdf..f708803e6857 100644
--- a/fs/ceph/messenger.c
+++ b/fs/ceph/messenger.c
@@ -2114,25 +2114,6 @@ static int ceph_alloc_middle(struct ceph_connection *con, struct ceph_msg *msg)
return 0;
}
-static int ceph_alloc_data_section(struct ceph_connection *con, struct ceph_msg *msg)
-{
- int ret;
- int want;
- int data_len = le32_to_cpu(msg->hdr.data_len);
- unsigned data_off = le16_to_cpu(msg->hdr.data_off);
-
- want = calc_pages_for(data_off & ~PAGE_MASK, data_len);
- ret = -1;
- mutex_unlock(&con->mutex);
- if (con->ops->prepare_pages)
- ret = con->ops->prepare_pages(con, msg, want);
- mutex_lock(&con->mutex);
-
- BUG_ON(msg->nr_pages < want);
-
- return ret;
-}
-
/*
* Generic message allocator, for incoming messages.
*/
@@ -2143,12 +2124,13 @@ static struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con,
int type = le16_to_cpu(hdr->type);
int front_len = le32_to_cpu(hdr->front_len);
int middle_len = le32_to_cpu(hdr->middle_len);
- int data_len = le32_to_cpu(hdr->data_len);
struct ceph_msg *msg = NULL;
int ret;
if (con->ops->alloc_msg) {
+ mutex_unlock(&con->mutex);
msg = con->ops->alloc_msg(con, hdr, skip);
+ mutex_lock(&con->mutex);
if (IS_ERR(msg))
return msg;
@@ -2175,17 +2157,6 @@ static struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con,
}
}
- if (data_len) {
- ret = ceph_alloc_data_section(con, msg);
-
- if (ret < 0) {
- *skip = 1;
- ceph_msg_put(msg);
- return NULL;
- }
- }
-
-
return msg;
}
OpenPOWER on IntegriCloud