aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-06-26 15:57:03 -0400
committerAlex Elder <elder@inktank.com>2012-10-01 15:30:52 -0400
commit3cb4a687c72bd16c95f514933d68884eacac4e4e (patch)
tree97d9d9081bc3ca87e4a9d310c657fbead430d848 /drivers/block/rbd.c
parent3ee4001e0c875ce8ebcdf5ea305e9a105b3687bd (diff)
rbd: pass flags to rbd_req_sync_exec()
In order to allow both read requests and write requests to be initiated using rbd_req_sync_exec(), add an OSD flags value which can be passed down to rbd_req_sync_op(). Rename the "data" and "len" parameters to be more clear that they represent data that is outbound. At this point, this function is still only used (and only works) for write requests. 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.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 61807c32996e..ad26502f4b0f 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1437,23 +1437,33 @@ fail:
1437} 1437}
1438 1438
1439/* 1439/*
1440 * Request sync osd read 1440 * Synchronous osd object method call
1441 */ 1441 */
1442static int rbd_req_sync_exec(struct rbd_device *rbd_dev, 1442static int rbd_req_sync_exec(struct rbd_device *rbd_dev,
1443 const char *object_name, 1443 const char *object_name,
1444 const char *class_name, 1444 const char *class_name,
1445 const char *method_name, 1445 const char *method_name,
1446 const char *data, 1446 const char *outbound,
1447 int len, 1447 size_t outbound_size,
1448 int flags,
1448 u64 *ver) 1449 u64 *ver)
1449{ 1450{
1450 struct ceph_osd_req_op *ops; 1451 struct ceph_osd_req_op *ops;
1451 int class_name_len = strlen(class_name); 1452 int class_name_len = strlen(class_name);
1452 int method_name_len = strlen(method_name); 1453 int method_name_len = strlen(method_name);
1454 int payload_size;
1453 int ret; 1455 int ret;
1454 1456
1455 ops = rbd_create_rw_ops(1, CEPH_OSD_OP_CALL, 1457 /*
1456 class_name_len + method_name_len + len); 1458 * Any input parameters required by the method we're calling
1459 * will be sent along with the class and method names as
1460 * part of the message payload. That data and its size are
1461 * supplied via the indata and indata_len fields (named from
1462 * the perspective of the server side) in the OSD request
1463 * operation.
1464 */
1465 payload_size = class_name_len + method_name_len + outbound_size;
1466 ops = rbd_create_rw_ops(1, CEPH_OSD_OP_CALL, payload_size);
1457 if (!ops) 1467 if (!ops)
1458 return -ENOMEM; 1468 return -ENOMEM;
1459 1469
@@ -1462,13 +1472,12 @@ static int rbd_req_sync_exec(struct rbd_device *rbd_dev,
1462 ops[0].cls.method_name = method_name; 1472 ops[0].cls.method_name = method_name;
1463 ops[0].cls.method_len = (__u8) method_name_len; 1473 ops[0].cls.method_len = (__u8) method_name_len;
1464 ops[0].cls.argc = 0; 1474 ops[0].cls.argc = 0;
1465 ops[0].cls.indata = data; 1475 ops[0].cls.indata = outbound;
1466 ops[0].cls.indata_len = len; 1476 ops[0].cls.indata_len = outbound_size;
1467 1477
1468 ret = rbd_req_sync_op(rbd_dev, NULL, 1478 ret = rbd_req_sync_op(rbd_dev, NULL,
1469 CEPH_NOSNAP, 1479 CEPH_NOSNAP,
1470 CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, 1480 flags, ops,
1471 ops,
1472 object_name, 0, 0, NULL, NULL, ver); 1481 object_name, 0, 0, NULL, NULL, ver);
1473 1482
1474 rbd_destroy_ops(ops); 1483 rbd_destroy_ops(ops);
@@ -1780,7 +1789,9 @@ static int rbd_header_add_snap(struct rbd_device *rbd_dev,
1780 1789
1781 ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name, 1790 ret = rbd_req_sync_exec(rbd_dev, rbd_dev->header_name,
1782 "rbd", "snap_add", 1791 "rbd", "snap_add",
1783 data, p - data, NULL); 1792 data, (size_t) (p - data),
1793 CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK,
1794 NULL);
1784 1795
1785 kfree(data); 1796 kfree(data);
1786 1797