aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-11-19 23:55:21 -0500
committerAlex Elder <elder@inktank.com>2013-01-17 17:34:58 -0500
commitc561191813e232aa52022532751855ff5c9fa319 (patch)
treeb91e45b3a6c7d2c39901367bb1d56992247abd8e /drivers/block
parent1821665749a3d7e26ad470c63fc2c46990dc6041 (diff)
rbd: don't assign extent info in rbd_do_request()
In rbd_do_request() there's a sort of last-minute assignment of the extent offset and length and payload length for read and write operations. Move those assignments into the caller (in those spots that might initiate read or write operations) Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rbd.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 619d680960b1..c6917b11800b 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1156,13 +1156,6 @@ static int rbd_do_request(struct request *rq,
1156 osd_req->r_oid_len = strlen(osd_req->r_oid); 1156 osd_req->r_oid_len = strlen(osd_req->r_oid);
1157 1157
1158 osd_req->r_file_layout = rbd_dev->layout; /* struct */ 1158 osd_req->r_file_layout = rbd_dev->layout; /* struct */
1159
1160 if (op->op == CEPH_OSD_OP_READ || op->op == CEPH_OSD_OP_WRITE) {
1161 op->extent.offset = ofs;
1162 op->extent.length = len;
1163 if (op->op == CEPH_OSD_OP_WRITE)
1164 op->payload_len = len;
1165 }
1166 osd_req->r_num_pages = calc_pages_for(ofs, len); 1159 osd_req->r_num_pages = calc_pages_for(ofs, len);
1167 osd_req->r_page_alignment = ofs & ~PAGE_MASK; 1160 osd_req->r_page_alignment = ofs & ~PAGE_MASK;
1168 1161
@@ -1269,6 +1262,13 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev,
1269 if (IS_ERR(pages)) 1262 if (IS_ERR(pages))
1270 return PTR_ERR(pages); 1263 return PTR_ERR(pages);
1271 1264
1265 if (op->op == CEPH_OSD_OP_READ || op->op == CEPH_OSD_OP_WRITE) {
1266 op->extent.offset = ofs;
1267 op->extent.length = inbound_size;
1268 if (op->op == CEPH_OSD_OP_WRITE)
1269 op->payload_len = inbound_size;
1270 }
1271
1272 ret = rbd_do_request(NULL, rbd_dev, NULL, CEPH_NOSNAP, 1272 ret = rbd_do_request(NULL, rbd_dev, NULL, CEPH_NOSNAP,
1273 object_name, ofs, inbound_size, NULL, 1273 object_name, ofs, inbound_size, NULL,
1274 pages, num_pages, 1274 pages, num_pages,
@@ -1332,6 +1332,9 @@ static int rbd_do_op(struct request *rq,
1332 op = rbd_create_rw_op(opcode, payload_len); 1332 op = rbd_create_rw_op(opcode, payload_len);
1333 if (!op) 1333 if (!op)
1334 goto done; 1334 goto done;
1335 op->extent.offset = seg_ofs;
1336 op->extent.length = seg_len;
1337 op->payload_len = payload_len;
1335 1338
1336 /* we've taken care of segment sizes earlier when we 1339 /* we've taken care of segment sizes earlier when we
1337 cloned the bios. We should never have a segment 1340 cloned the bios. We should never have a segment