aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-07-03 17:01:19 -0400
committerAlex Elder <elder@inktank.com>2012-10-01 15:30:53 -0400
commitf8d4de6e1c939d56f1ee0a21ad677401846f990c (patch)
tree3f8a13255b597ea1d45a3d21843077a1d4498918 /drivers/block
parent3cb4a687c72bd16c95f514933d68884eacac4e4e (diff)
rbd: support data returned from OSD methods
An OSD object method call can be made using rbd_req_sync_exec(). Until now this has only been used for creating a new RBD snapshot, and that has only required sending data out, not receiving anything back from the OSD. We will now need to get data back from an OSD on a method call, so add parameters to rbd_req_sync_exec() that allow a buffer into which returned data should be placed to be specified, along with its size. Previously, rbd_req_sync_exec() passed a null pointer and zero size to rbd_req_sync_op(); change this so the new inbound buffer information is provided instead. Rename the "buf" and "len" parameters in rbd_req_sync_op() to make it more obvious they are describing inbound data. 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.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index ad26502f4b0f..b8956131950c 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1098,8 +1098,8 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev,
1098 int flags, 1098 int flags,
1099 struct ceph_osd_req_op *ops, 1099 struct ceph_osd_req_op *ops,
1100 const char *object_name, 1100 const char *object_name,
1101 u64 ofs, u64 len, 1101 u64 ofs, u64 inbound_size,
1102 char *buf, 1102 char *inbound,
1103 struct ceph_osd_request **linger_req, 1103 struct ceph_osd_request **linger_req,
1104 u64 *ver) 1104 u64 *ver)
1105{ 1105{
@@ -1109,13 +1109,13 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev,
1109 1109
1110 rbd_assert(ops != NULL); 1110 rbd_assert(ops != NULL);
1111 1111
1112 num_pages = calc_pages_for(ofs , len); 1112 num_pages = calc_pages_for(ofs, inbound_size);
1113 pages = ceph_alloc_page_vector(num_pages, GFP_KERNEL); 1113 pages = ceph_alloc_page_vector(num_pages, GFP_KERNEL);
1114 if (IS_ERR(pages)) 1114 if (IS_ERR(pages))
1115 return PTR_ERR(pages); 1115 return PTR_ERR(pages);
1116 1116
1117 ret = rbd_do_request(NULL, rbd_dev, snapc, snapid, 1117 ret = rbd_do_request(NULL, rbd_dev, snapc, snapid,
1118 object_name, ofs, len, NULL, 1118 object_name, ofs, inbound_size, NULL,
1119 pages, num_pages, 1119 pages, num_pages,
1120 flags, 1120 flags,
1121 ops, 1121 ops,
@@ -1125,8 +1125,8 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev,
1125 if (ret < 0) 1125 if (ret < 0)
1126 goto done; 1126 goto done;
1127 1127
1128 if ((flags & CEPH_OSD_FLAG_READ) && buf) 1128 if ((flags & CEPH_OSD_FLAG_READ) && inbound)
1129 ret = ceph_copy_from_page_vector(pages, buf, ofs, ret); 1129 ret = ceph_copy_from_page_vector(pages, inbound, ofs, ret);
1130 1130
1131done: 1131done:
1132 ceph_release_page_vector(pages, num_pages); 1132 ceph_release_page_vector(pages, num_pages);
@@ -1445,6 +1445,8 @@ static int rbd_req_sync_exec(struct rbd_device *rbd_dev,
1445 const char *method_name, 1445 const char *method_name,
1446 const char *outbound, 1446 const char *outbound,
1447 size_t outbound_size, 1447 size_t outbound_size,
1448 char *inbound,
1449 size_t inbound_size,
1448 int flags, 1450 int flags,
1449 u64 *ver) 1451 u64 *ver)
1450{ 1452{
@@ -1478,7 +1480,8 @@ static int rbd_req_sync_exec(struct rbd_device *rbd_dev,
1478 ret = rbd_req_sync_op(rbd_dev, NULL, 1480 ret = rbd_req_sync_op(rbd_dev, NULL,
1479 CEPH_NOSNAP, 1481 CEPH_NOSNAP,
1480 flags, ops, 1482 flags, ops,
1481 object_name, 0, 0, NULL, NULL, ver); 1483 object_name, 0, inbound_size, inbound,
1484 NULL, ver);
1482 1485
1483 rbd_destroy_ops(ops); 1486 rbd_destroy_ops(ops);
1484 1487
@@ -1789,7 +1792,7 @@ static int rbd_header_add_snap(struct rbd_device *rbd_dev,
1789 1792
1790 ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name, 1793 ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name,
1791 "rbd", "snap_add", 1794 "rbd", "snap_add",
1792 data, (size_t) (p - data), 1795 data, (size_t) (p - data), NULL, 0,
1793 CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, 1796 CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK,
1794 NULL); 1797 NULL);
1795 1798