diff options
-rw-r--r-- | include/linux/ceph/osd_client.h | 9 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 79 |
2 files changed, 42 insertions, 46 deletions
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index dd4ca4ba8cab..4ec46c0ceaf7 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h | |||
@@ -87,14 +87,14 @@ struct ceph_osd_req_op { | |||
87 | u64 offset, length; | 87 | u64 offset, length; |
88 | u64 truncate_size; | 88 | u64 truncate_size; |
89 | u32 truncate_seq; | 89 | u32 truncate_seq; |
90 | struct ceph_osd_data *osd_data; | 90 | struct ceph_osd_data osd_data; |
91 | } extent; | 91 | } extent; |
92 | struct { | 92 | struct { |
93 | const char *class_name; | 93 | const char *class_name; |
94 | const char *method_name; | 94 | const char *method_name; |
95 | const void *request_data; | 95 | const void *request_data; |
96 | struct ceph_osd_data *request_info; | 96 | struct ceph_osd_data request_info; |
97 | struct ceph_osd_data *response_data; | 97 | struct ceph_osd_data response_data; |
98 | u32 request_data_len; | 98 | u32 request_data_len; |
99 | __u8 class_len; | 99 | __u8 class_len; |
100 | __u8 method_len; | 100 | __u8 method_len; |
@@ -164,9 +164,6 @@ struct ceph_osd_request { | |||
164 | 164 | ||
165 | struct ceph_file_layout r_file_layout; | 165 | struct ceph_file_layout r_file_layout; |
166 | struct ceph_snap_context *r_snapc; /* snap context for writes */ | 166 | struct ceph_snap_context *r_snapc; /* snap context for writes */ |
167 | |||
168 | struct ceph_osd_data r_data_in; | ||
169 | struct ceph_osd_data r_data_out; | ||
170 | }; | 167 | }; |
171 | 168 | ||
172 | struct ceph_osd_event { | 169 | struct ceph_osd_event { |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index cc4003fdc01f..2562e4e52245 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -121,8 +121,7 @@ osd_req_op_extent_osd_data(struct ceph_osd_request *osd_req, | |||
121 | { | 121 | { |
122 | BUG_ON(which >= osd_req->r_num_ops); | 122 | BUG_ON(which >= osd_req->r_num_ops); |
123 | 123 | ||
124 | /* return &osd_req->r_ops[which].extent.osd_data; */ | 124 | return &osd_req->r_ops[which].extent.osd_data; |
125 | return write_request ? &osd_req->r_data_out : &osd_req->r_data_in; | ||
126 | } | 125 | } |
127 | EXPORT_SYMBOL(osd_req_op_extent_osd_data); | 126 | EXPORT_SYMBOL(osd_req_op_extent_osd_data); |
128 | 127 | ||
@@ -132,8 +131,7 @@ osd_req_op_cls_request_info(struct ceph_osd_request *osd_req, | |||
132 | { | 131 | { |
133 | BUG_ON(which >= osd_req->r_num_ops); | 132 | BUG_ON(which >= osd_req->r_num_ops); |
134 | 133 | ||
135 | /* return &osd_req->r_ops[which].cls.request_info; */ | 134 | return &osd_req->r_ops[which].cls.request_info; |
136 | return &osd_req->r_data_out; /* Request data is outgoing */ | ||
137 | } | 135 | } |
138 | EXPORT_SYMBOL(osd_req_op_cls_request_info); /* ??? */ | 136 | EXPORT_SYMBOL(osd_req_op_cls_request_info); /* ??? */ |
139 | 137 | ||
@@ -143,8 +141,7 @@ osd_req_op_cls_response_data(struct ceph_osd_request *osd_req, | |||
143 | { | 141 | { |
144 | BUG_ON(which >= osd_req->r_num_ops); | 142 | BUG_ON(which >= osd_req->r_num_ops); |
145 | 143 | ||
146 | /* return &osd_req->r_ops[which].cls.response_data; */ | 144 | return &osd_req->r_ops[which].cls.response_data; |
147 | return &osd_req->r_data_in; /* Response data is incoming */ | ||
148 | } | 145 | } |
149 | EXPORT_SYMBOL(osd_req_op_cls_response_data); /* ??? */ | 146 | EXPORT_SYMBOL(osd_req_op_cls_response_data); /* ??? */ |
150 | 147 | ||
@@ -158,9 +155,6 @@ void osd_req_op_extent_osd_data_pages(struct ceph_osd_request *osd_req, | |||
158 | osd_data = osd_req_op_extent_osd_data(osd_req, which, write_request); | 155 | osd_data = osd_req_op_extent_osd_data(osd_req, which, write_request); |
159 | ceph_osd_data_pages_init(osd_data, pages, length, alignment, | 156 | ceph_osd_data_pages_init(osd_data, pages, length, alignment, |
160 | pages_from_pool, own_pages); | 157 | pages_from_pool, own_pages); |
161 | |||
162 | osd_req->r_ops[which].extent.osd_data = | ||
163 | osd_req_op_extent_osd_data(osd_req, which, write_request); | ||
164 | } | 158 | } |
165 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_pages); | 159 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_pages); |
166 | 160 | ||
@@ -172,9 +166,6 @@ void osd_req_op_extent_osd_data_pagelist(struct ceph_osd_request *osd_req, | |||
172 | 166 | ||
173 | osd_data = osd_req_op_extent_osd_data(osd_req, which, write_request); | 167 | osd_data = osd_req_op_extent_osd_data(osd_req, which, write_request); |
174 | ceph_osd_data_pagelist_init(osd_data, pagelist); | 168 | ceph_osd_data_pagelist_init(osd_data, pagelist); |
175 | |||
176 | osd_req->r_ops[which].extent.osd_data = | ||
177 | osd_req_op_extent_osd_data(osd_req, which, write_request); | ||
178 | } | 169 | } |
179 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_pagelist); | 170 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_pagelist); |
180 | 171 | ||
@@ -187,9 +178,6 @@ void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *osd_req, | |||
187 | 178 | ||
188 | osd_data = osd_req_op_extent_osd_data(osd_req, which, write_request); | 179 | osd_data = osd_req_op_extent_osd_data(osd_req, which, write_request); |
189 | ceph_osd_data_bio_init(osd_data, bio, bio_length); | 180 | ceph_osd_data_bio_init(osd_data, bio, bio_length); |
190 | |||
191 | osd_req->r_ops[which].extent.osd_data = | ||
192 | osd_req_op_extent_osd_data(osd_req, which, write_request); | ||
193 | } | 181 | } |
194 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_bio); | 182 | EXPORT_SYMBOL(osd_req_op_extent_osd_data_bio); |
195 | #endif /* CONFIG_BLOCK */ | 183 | #endif /* CONFIG_BLOCK */ |
@@ -202,9 +190,6 @@ static void osd_req_op_cls_request_info_pagelist( | |||
202 | 190 | ||
203 | osd_data = osd_req_op_cls_request_info(osd_req, which); | 191 | osd_data = osd_req_op_cls_request_info(osd_req, which); |
204 | ceph_osd_data_pagelist_init(osd_data, pagelist); | 192 | ceph_osd_data_pagelist_init(osd_data, pagelist); |
205 | |||
206 | osd_req->r_ops[which].cls.request_info = | ||
207 | osd_req_op_cls_request_info(osd_req, which); | ||
208 | } | 193 | } |
209 | 194 | ||
210 | void osd_req_op_cls_response_data_pages(struct ceph_osd_request *osd_req, | 195 | void osd_req_op_cls_response_data_pages(struct ceph_osd_request *osd_req, |
@@ -216,9 +201,6 @@ void osd_req_op_cls_response_data_pages(struct ceph_osd_request *osd_req, | |||
216 | osd_data = osd_req_op_cls_response_data(osd_req, which); | 201 | osd_data = osd_req_op_cls_response_data(osd_req, which); |
217 | ceph_osd_data_pages_init(osd_data, pages, length, alignment, | 202 | ceph_osd_data_pages_init(osd_data, pages, length, alignment, |
218 | pages_from_pool, own_pages); | 203 | pages_from_pool, own_pages); |
219 | |||
220 | osd_req->r_ops[which].cls.response_data = | ||
221 | osd_req_op_cls_response_data(osd_req, which); | ||
222 | } | 204 | } |
223 | EXPORT_SYMBOL(osd_req_op_cls_response_data_pages); | 205 | EXPORT_SYMBOL(osd_req_op_cls_response_data_pages); |
224 | 206 | ||
@@ -241,18 +223,39 @@ static u64 ceph_osd_data_length(struct ceph_osd_data *osd_data) | |||
241 | } | 223 | } |
242 | } | 224 | } |
243 | 225 | ||
226 | |||
244 | static void ceph_osd_data_release(struct ceph_osd_data *osd_data) | 227 | static void ceph_osd_data_release(struct ceph_osd_data *osd_data) |
245 | { | 228 | { |
246 | if (osd_data->type != CEPH_OSD_DATA_TYPE_PAGES) | 229 | if (osd_data->type == CEPH_OSD_DATA_TYPE_PAGES && osd_data->own_pages) { |
247 | return; | ||
248 | |||
249 | if (osd_data->own_pages) { | ||
250 | int num_pages; | 230 | int num_pages; |
251 | 231 | ||
252 | num_pages = calc_pages_for((u64)osd_data->alignment, | 232 | num_pages = calc_pages_for((u64)osd_data->alignment, |
253 | (u64)osd_data->length); | 233 | (u64)osd_data->length); |
254 | ceph_release_page_vector(osd_data->pages, num_pages); | 234 | ceph_release_page_vector(osd_data->pages, num_pages); |
255 | } | 235 | } |
236 | ceph_osd_data_init(osd_data); | ||
237 | } | ||
238 | |||
239 | static void osd_req_op_data_release(struct ceph_osd_request *osd_req, | ||
240 | unsigned int which) | ||
241 | { | ||
242 | struct ceph_osd_req_op *op; | ||
243 | |||
244 | BUG_ON(which >= osd_req->r_num_ops); | ||
245 | op = &osd_req->r_ops[which]; | ||
246 | |||
247 | switch (op->op) { | ||
248 | case CEPH_OSD_OP_READ: | ||
249 | case CEPH_OSD_OP_WRITE: | ||
250 | ceph_osd_data_release(&op->extent.osd_data); | ||
251 | break; | ||
252 | case CEPH_OSD_OP_CALL: | ||
253 | ceph_osd_data_release(&op->cls.request_info); | ||
254 | ceph_osd_data_release(&op->cls.response_data); | ||
255 | break; | ||
256 | default: | ||
257 | break; | ||
258 | } | ||
256 | } | 259 | } |
257 | 260 | ||
258 | /* | 261 | /* |
@@ -261,6 +264,7 @@ static void ceph_osd_data_release(struct ceph_osd_data *osd_data) | |||
261 | void ceph_osdc_release_request(struct kref *kref) | 264 | void ceph_osdc_release_request(struct kref *kref) |
262 | { | 265 | { |
263 | struct ceph_osd_request *req; | 266 | struct ceph_osd_request *req; |
267 | unsigned int which; | ||
264 | 268 | ||
265 | req = container_of(kref, struct ceph_osd_request, r_kref); | 269 | req = container_of(kref, struct ceph_osd_request, r_kref); |
266 | if (req->r_request) | 270 | if (req->r_request) |
@@ -270,8 +274,8 @@ void ceph_osdc_release_request(struct kref *kref) | |||
270 | ceph_msg_put(req->r_reply); | 274 | ceph_msg_put(req->r_reply); |
271 | } | 275 | } |
272 | 276 | ||
273 | ceph_osd_data_release(&req->r_data_in); | 277 | for (which = 0; which < req->r_num_ops; which++) |
274 | ceph_osd_data_release(&req->r_data_out); | 278 | osd_req_op_data_release(req, which); |
275 | 279 | ||
276 | ceph_put_snap_context(req->r_snapc); | 280 | ceph_put_snap_context(req->r_snapc); |
277 | if (req->r_mempool) | 281 | if (req->r_mempool) |
@@ -595,27 +599,22 @@ static u64 osd_req_encode_op(struct ceph_osd_request *req, | |||
595 | cpu_to_le64(src->extent.truncate_size); | 599 | cpu_to_le64(src->extent.truncate_size); |
596 | dst->extent.truncate_seq = | 600 | dst->extent.truncate_seq = |
597 | cpu_to_le32(src->extent.truncate_seq); | 601 | cpu_to_le32(src->extent.truncate_seq); |
598 | if (src->op == CEPH_OSD_OP_WRITE) { | 602 | if (src->op == CEPH_OSD_OP_WRITE) |
599 | WARN_ON(src->extent.osd_data != &req->r_data_out); | ||
600 | ceph_osdc_msg_data_set(req->r_request, | 603 | ceph_osdc_msg_data_set(req->r_request, |
601 | src->extent.osd_data); | 604 | &src->extent.osd_data); |
602 | } else { | 605 | else |
603 | WARN_ON(src->extent.osd_data != &req->r_data_in); | ||
604 | ceph_osdc_msg_data_set(req->r_reply, | 606 | ceph_osdc_msg_data_set(req->r_reply, |
605 | src->extent.osd_data); | 607 | &src->extent.osd_data); |
606 | } | ||
607 | break; | 608 | break; |
608 | case CEPH_OSD_OP_CALL: | 609 | case CEPH_OSD_OP_CALL: |
609 | dst->cls.class_len = src->cls.class_len; | 610 | dst->cls.class_len = src->cls.class_len; |
610 | dst->cls.method_len = src->cls.method_len; | 611 | dst->cls.method_len = src->cls.method_len; |
611 | dst->cls.indata_len = cpu_to_le32(src->cls.request_data_len); | 612 | dst->cls.indata_len = cpu_to_le32(src->cls.request_data_len); |
612 | WARN_ON(src->cls.response_data != &req->r_data_in); | 613 | ceph_osdc_msg_data_set(req->r_reply, &src->cls.response_data); |
613 | ceph_osdc_msg_data_set(req->r_reply, src->cls.response_data); | 614 | ceph_osdc_msg_data_set(req->r_request, &src->cls.request_info); |
614 | WARN_ON(src->cls.request_info != &req->r_data_out); | 615 | BUG_ON(src->cls.request_info.type != |
615 | ceph_osdc_msg_data_set(req->r_request, src->cls.request_info); | ||
616 | BUG_ON(src->cls.request_info->type != | ||
617 | CEPH_OSD_DATA_TYPE_PAGELIST); | 616 | CEPH_OSD_DATA_TYPE_PAGELIST); |
618 | request_data_len = src->cls.request_info->pagelist->length; | 617 | request_data_len = src->cls.request_info.pagelist->length; |
619 | break; | 618 | break; |
620 | case CEPH_OSD_OP_STARTSYNC: | 619 | case CEPH_OSD_OP_STARTSYNC: |
621 | break; | 620 | break; |