aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2013-05-10 17:29:22 -0400
committerAlex Elder <elder@inktank.com>2013-05-13 15:12:40 -0400
commitb91f09f17b2a302f07022e2f766969e2536d71b3 (patch)
treeeb26ac4e2aa995cf45c2c6bdbbd4d62b49f1dc24 /drivers/block/rbd.c
parentebda6408f2227a774343c3cc2861384942143ff3 (diff)
rbd: support reading parent page data for writes
Currently, rbd_img_obj_parent_read_full() assumes the incoming object request contains bio data. But if a layered image is part of a multi-layer stack of images it will result in read requests of page data to parent images. This is handling the same kind of issue as was resolved by this commit: 5b2ab72d rbd: support reading parent page data This resolves: http://tracker.ceph.com/issues/5027 Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 597b9bbe2fc7..5161e80a38ef 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -2165,6 +2165,8 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request)
2165 u32 page_count; 2165 u32 page_count;
2166 int result; 2166 int result;
2167 u64 parent_length; 2167 u64 parent_length;
2168 u64 offset;
2169 u64 length;
2168 2170
2169 rbd_assert(img_request_child_test(img_request)); 2171 rbd_assert(img_request_child_test(img_request));
2170 2172
@@ -2179,7 +2181,7 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request)
2179 2181
2180 orig_request = img_request->obj_request; 2182 orig_request = img_request->obj_request;
2181 rbd_assert(orig_request != NULL); 2183 rbd_assert(orig_request != NULL);
2182 rbd_assert(orig_request->type == OBJ_REQUEST_BIO); 2184 rbd_assert(obj_request_type_valid(orig_request->type));
2183 result = img_request->result; 2185 result = img_request->result;
2184 parent_length = img_request->length; 2186 parent_length = img_request->length;
2185 rbd_assert(parent_length == img_request->xferred); 2187 rbd_assert(parent_length == img_request->xferred);
@@ -2211,11 +2213,17 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request)
2211 2213
2212 /* Then the original write request op */ 2214 /* Then the original write request op */
2213 2215
2216 offset = orig_request->offset;
2217 length = orig_request->length;
2214 osd_req_op_extent_init(osd_req, 1, CEPH_OSD_OP_WRITE, 2218 osd_req_op_extent_init(osd_req, 1, CEPH_OSD_OP_WRITE,
2215 orig_request->offset, 2219 offset, length, 0, 0);
2216 orig_request->length, 0, 0); 2220 if (orig_request->type == OBJ_REQUEST_BIO)
2217 osd_req_op_extent_osd_data_bio(osd_req, 1, orig_request->bio_list, 2221 osd_req_op_extent_osd_data_bio(osd_req, 1,
2218 orig_request->length); 2222 orig_request->bio_list, length);
2223 else
2224 osd_req_op_extent_osd_data_pages(osd_req, 1,
2225 orig_request->pages, length,
2226 offset & ~PAGE_MASK, false, false);
2219 2227
2220 rbd_osd_req_format_write(orig_request); 2228 rbd_osd_req_format_write(orig_request);
2221 2229
@@ -2261,7 +2269,7 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
2261 int result; 2269 int result;
2262 2270
2263 rbd_assert(obj_request_img_data_test(obj_request)); 2271 rbd_assert(obj_request_img_data_test(obj_request));
2264 rbd_assert(obj_request->type == OBJ_REQUEST_BIO); 2272 rbd_assert(obj_request_type_valid(obj_request->type));
2265 2273
2266 img_request = obj_request->img_request; 2274 img_request = obj_request->img_request;
2267 rbd_assert(img_request != NULL); 2275 rbd_assert(img_request != NULL);