aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorAlex Elder <elder@inktank.com>2012-11-13 22:11:15 -0500
committerAlex Elder <elder@inktank.com>2013-01-17 17:34:57 -0500
commitae7ca4a35b1f5df86e2c32b2cfc01a8d528c7b8c (patch)
treea6dfed1fd8f50cf59cd72be27408f51ee621607c /drivers/block
parentd07c09589f533db9ab500ac38151bc9f3a4d0648 (diff)
libceph: pass num_op with ops
Both ceph_osdc_alloc_request() and ceph_osdc_build_request() are provided an array of ceph osd request operations. Rather than just passing the number of operations in the array, the caller is required append an additional zeroed operation structure to signal the end of the array. All callers know the number of operations at the time these functions are called, so drop the silly zero entry and supply that number directly. As a result, get_num_ops() is no longer needed. This also means that ceph_osdc_alloc_request() never uses its ops argument, so that can be dropped. Also rbd_create_rw_ops() no longer needs to add one to reserve room for the additional op. 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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index b6872d3cb04c..88de8ccb29bd 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1026,12 +1026,12 @@ out_err:
1026/* 1026/*
1027 * helpers for osd request op vectors. 1027 * helpers for osd request op vectors.
1028 */ 1028 */
1029static struct ceph_osd_req_op *rbd_create_rw_ops(int num_ops, 1029static struct ceph_osd_req_op *rbd_create_rw_ops(int num_op,
1030 int opcode, u32 payload_len) 1030 int opcode, u32 payload_len)
1031{ 1031{
1032 struct ceph_osd_req_op *ops; 1032 struct ceph_osd_req_op *ops;
1033 1033
1034 ops = kzalloc(sizeof (*ops) * (num_ops + 1), GFP_NOIO); 1034 ops = kzalloc(num_op * sizeof (*ops), GFP_NOIO);
1035 if (!ops) 1035 if (!ops)
1036 return NULL; 1036 return NULL;
1037 1037
@@ -1149,7 +1149,7 @@ static int rbd_do_request(struct request *rq,
1149 (unsigned long long) len, coll, coll_index); 1149 (unsigned long long) len, coll, coll_index);
1150 1150
1151 osdc = &rbd_dev->rbd_client->client->osdc; 1151 osdc = &rbd_dev->rbd_client->client->osdc;
1152 osd_req = ceph_osdc_alloc_request(osdc, snapc, ops, false, GFP_NOIO); 1152 osd_req = ceph_osdc_alloc_request(osdc, snapc, num_op, false, GFP_NOIO);
1153 if (!osd_req) { 1153 if (!osd_req) {
1154 ret = -ENOMEM; 1154 ret = -ENOMEM;
1155 goto done_pages; 1155 goto done_pages;
@@ -1178,7 +1178,8 @@ static int rbd_do_request(struct request *rq,
1178 ofs, &len, &bno, osd_req, ops); 1178 ofs, &len, &bno, osd_req, ops);
1179 rbd_assert(ret == 0); 1179 rbd_assert(ret == 0);
1180 1180
1181 ceph_osdc_build_request(osd_req, ofs, len, ops, snapc, snapid, &mtime); 1181 ceph_osdc_build_request(osd_req, ofs, len, num_op, ops,
1182 snapc, snapid, &mtime);
1182 1183
1183 if (linger_req) { 1184 if (linger_req) {
1184 ceph_osdc_set_request_linger(osdc, osd_req); 1185 ceph_osdc_set_request_linger(osdc, osd_req);