提交 d07c0958 编写于 作者: A Alex Elder

rbd: pass num_op with ops array

Add a num_op parameter to rbd_do_request() and rbd_req_sync_op() to
indicate the number of entries in the array.  The callers of these
functions always know how many entries are in the array, so just
pass that information down.

This is in anticipation of eliminating the extra zero-filled entry
in these ops arrays.
Signed-off-by: NAlex Elder <elder@inktank.com>
Reviewed-by: NJosh Durgin <josh.durgin@inktank.com>
上级 54a54007
...@@ -1119,6 +1119,7 @@ static int rbd_do_request(struct request *rq, ...@@ -1119,6 +1119,7 @@ static int rbd_do_request(struct request *rq,
struct page **pages, struct page **pages,
int num_pages, int num_pages,
int flags, int flags,
unsigned int num_op,
struct ceph_osd_req_op *ops, struct ceph_osd_req_op *ops,
struct rbd_req_coll *coll, struct rbd_req_coll *coll,
int coll_index, int coll_index,
...@@ -1259,6 +1260,7 @@ static void rbd_simple_req_cb(struct ceph_osd_request *osd_req, ...@@ -1259,6 +1260,7 @@ static void rbd_simple_req_cb(struct ceph_osd_request *osd_req,
*/ */
static int rbd_req_sync_op(struct rbd_device *rbd_dev, static int rbd_req_sync_op(struct rbd_device *rbd_dev,
int flags, int flags,
unsigned int num_op,
struct ceph_osd_req_op *ops, struct ceph_osd_req_op *ops,
const char *object_name, const char *object_name,
u64 ofs, u64 inbound_size, u64 ofs, u64 inbound_size,
...@@ -1281,7 +1283,7 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev, ...@@ -1281,7 +1283,7 @@ static int rbd_req_sync_op(struct rbd_device *rbd_dev,
object_name, ofs, inbound_size, NULL, object_name, ofs, inbound_size, NULL,
pages, num_pages, pages, num_pages,
flags, flags,
ops, num_op, ops,
NULL, 0, NULL, 0,
NULL, NULL,
linger_req, ver); linger_req, ver);
...@@ -1351,7 +1353,7 @@ static int rbd_do_op(struct request *rq, ...@@ -1351,7 +1353,7 @@ static int rbd_do_op(struct request *rq,
bio, bio,
NULL, 0, NULL, 0,
flags, flags,
ops, 1, ops,
coll, coll_index, coll, coll_index,
rbd_req_cb, 0, NULL); rbd_req_cb, 0, NULL);
if (ret < 0) if (ret < 0)
...@@ -1380,7 +1382,7 @@ static int rbd_req_sync_read(struct rbd_device *rbd_dev, ...@@ -1380,7 +1382,7 @@ static int rbd_req_sync_read(struct rbd_device *rbd_dev,
return -ENOMEM; return -ENOMEM;
ret = rbd_req_sync_op(rbd_dev, CEPH_OSD_FLAG_READ, ret = rbd_req_sync_op(rbd_dev, CEPH_OSD_FLAG_READ,
ops, object_name, ofs, len, buf, NULL, ver); 1, ops, object_name, ofs, len, buf, NULL, ver);
rbd_destroy_ops(ops); rbd_destroy_ops(ops);
return ret; return ret;
...@@ -1408,7 +1410,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *rbd_dev, ...@@ -1408,7 +1410,7 @@ static int rbd_req_sync_notify_ack(struct rbd_device *rbd_dev,
rbd_dev->header_name, 0, 0, NULL, rbd_dev->header_name, 0, 0, NULL,
NULL, 0, NULL, 0,
CEPH_OSD_FLAG_READ, CEPH_OSD_FLAG_READ,
ops, 1, ops,
NULL, 0, NULL, 0,
rbd_simple_req_cb, 0, NULL); rbd_simple_req_cb, 0, NULL);
...@@ -1460,7 +1462,7 @@ static int rbd_req_sync_watch(struct rbd_device *rbd_dev) ...@@ -1460,7 +1462,7 @@ static int rbd_req_sync_watch(struct rbd_device *rbd_dev)
ret = rbd_req_sync_op(rbd_dev, ret = rbd_req_sync_op(rbd_dev,
CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK,
ops, 1, ops,
rbd_dev->header_name, rbd_dev->header_name,
0, 0, NULL, 0, 0, NULL,
&rbd_dev->watch_request, NULL); &rbd_dev->watch_request, NULL);
...@@ -1497,7 +1499,7 @@ static int rbd_req_sync_unwatch(struct rbd_device *rbd_dev) ...@@ -1497,7 +1499,7 @@ static int rbd_req_sync_unwatch(struct rbd_device *rbd_dev)
ret = rbd_req_sync_op(rbd_dev, ret = rbd_req_sync_op(rbd_dev,
CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK, CEPH_OSD_FLAG_WRITE | CEPH_OSD_FLAG_ONDISK,
ops, 1, ops,
rbd_dev->header_name, rbd_dev->header_name,
0, 0, NULL, NULL, NULL); 0, 0, NULL, NULL, NULL);
...@@ -1548,7 +1550,7 @@ static int rbd_req_sync_exec(struct rbd_device *rbd_dev, ...@@ -1548,7 +1550,7 @@ static int rbd_req_sync_exec(struct rbd_device *rbd_dev,
ops[0].cls.indata = outbound; ops[0].cls.indata = outbound;
ops[0].cls.indata_len = outbound_size; ops[0].cls.indata_len = outbound_size;
ret = rbd_req_sync_op(rbd_dev, CEPH_OSD_FLAG_READ, ops, ret = rbd_req_sync_op(rbd_dev, CEPH_OSD_FLAG_READ, 1, ops,
object_name, 0, inbound_size, inbound, object_name, 0, inbound_size, inbound,
NULL, ver); NULL, ver);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册