diff options
Diffstat (limited to 'fs/ceph/messenger.c')
-rw-r--r-- | fs/ceph/messenger.c | 33 |
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) | |||
2114 | return 0; | 2114 | return 0; |
2115 | } | 2115 | } |
2116 | 2116 | ||
2117 | static int ceph_alloc_data_section(struct ceph_connection *con, struct ceph_msg *msg) | ||
2118 | { | ||
2119 | int ret; | ||
2120 | int want; | ||
2121 | int data_len = le32_to_cpu(msg->hdr.data_len); | ||
2122 | unsigned data_off = le16_to_cpu(msg->hdr.data_off); | ||
2123 | |||
2124 | want = calc_pages_for(data_off & ~PAGE_MASK, data_len); | ||
2125 | ret = -1; | ||
2126 | mutex_unlock(&con->mutex); | ||
2127 | if (con->ops->prepare_pages) | ||
2128 | ret = con->ops->prepare_pages(con, msg, want); | ||
2129 | mutex_lock(&con->mutex); | ||
2130 | |||
2131 | BUG_ON(msg->nr_pages < want); | ||
2132 | |||
2133 | return ret; | ||
2134 | } | ||
2135 | |||
2136 | /* | 2117 | /* |
2137 | * Generic message allocator, for incoming messages. | 2118 | * Generic message allocator, for incoming messages. |
2138 | */ | 2119 | */ |
@@ -2143,12 +2124,13 @@ static struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con, | |||
2143 | int type = le16_to_cpu(hdr->type); | 2124 | int type = le16_to_cpu(hdr->type); |
2144 | int front_len = le32_to_cpu(hdr->front_len); | 2125 | int front_len = le32_to_cpu(hdr->front_len); |
2145 | int middle_len = le32_to_cpu(hdr->middle_len); | 2126 | int middle_len = le32_to_cpu(hdr->middle_len); |
2146 | int data_len = le32_to_cpu(hdr->data_len); | ||
2147 | struct ceph_msg *msg = NULL; | 2127 | struct ceph_msg *msg = NULL; |
2148 | int ret; | 2128 | int ret; |
2149 | 2129 | ||
2150 | if (con->ops->alloc_msg) { | 2130 | if (con->ops->alloc_msg) { |
2131 | mutex_unlock(&con->mutex); | ||
2151 | msg = con->ops->alloc_msg(con, hdr, skip); | 2132 | msg = con->ops->alloc_msg(con, hdr, skip); |
2133 | mutex_lock(&con->mutex); | ||
2152 | if (IS_ERR(msg)) | 2134 | if (IS_ERR(msg)) |
2153 | return msg; | 2135 | return msg; |
2154 | 2136 | ||
@@ -2175,17 +2157,6 @@ static struct ceph_msg *ceph_alloc_msg(struct ceph_connection *con, | |||
2175 | } | 2157 | } |
2176 | } | 2158 | } |
2177 | 2159 | ||
2178 | if (data_len) { | ||
2179 | ret = ceph_alloc_data_section(con, msg); | ||
2180 | |||
2181 | if (ret < 0) { | ||
2182 | *skip = 1; | ||
2183 | ceph_msg_put(msg); | ||
2184 | return NULL; | ||
2185 | } | ||
2186 | } | ||
2187 | |||
2188 | |||
2189 | return msg; | 2160 | return msg; |
2190 | } | 2161 | } |
2191 | 2162 | ||