diff options
author | Alex Elder <elder@inktank.com> | 2013-04-05 02:27:12 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:18:25 -0400 |
commit | 5476492fba9fd0b4118aacf5b924dd29b8cca56c (patch) | |
tree | e012b546f1f0d33bd016f8af278f79e4ae1df4da /net/ceph | |
parent | ec9123c56787fa7fb2608f05b19d21c5e1912d87 (diff) |
libceph: kill off osd request r_data_in and r_data_out
Finally! Convert the osd op data pointers into real structures, and
make the switch over to using them instead of having all ops share
the in and/or out data structures in the osd request.
Set up a new function to traverse the set of ops and release any
data associated with them (pages).
This and the patches leading up to it resolve:
http://tracker.ceph.com/issues/4657
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'net/ceph')
-rw-r--r-- | net/ceph/osd_client.c | 79 |
1 files changed, 39 insertions, 40 deletions
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; |