From: Mike Christie <michaelc@xxxxxxxxxxx> The next patches add new commands that have different number of ops, so this adds a helper. Signed-off-by: Mike Christie <michaelc@xxxxxxxxxxx> --- drivers/block/rbd.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 8d0b30a..425c3d8 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -813,6 +813,16 @@ static int parse_rbd_opts_token(char *c, void *private) return 0; } +static int obj_num_ops(enum obj_operation_type op_type) +{ + switch (op_type) { + case OBJ_OP_WRITE: + return 2; + default: + return 1; + } +} + static char* obj_op_name(enum obj_operation_type op_type) { switch (op_type) { @@ -1987,7 +1997,7 @@ static struct ceph_osd_request *rbd_osd_req_create( snapc = img_request->snapc; } - rbd_assert(num_ops == 1 || ((op_type == OBJ_OP_WRITE) && num_ops == 2)); + rbd_assert(num_ops == 1 || obj_num_ops(op_type) == num_ops); /* Allocate and initialize the request, for the num_ops ops */ @@ -2589,8 +2599,7 @@ static int rbd_img_request_fill(struct rbd_img_request *img_request, } osd_req = rbd_osd_req_create(rbd_dev, op_type, - (op_type == OBJ_OP_WRITE) ? 2 : 1, - obj_request); + obj_num_ops(op_type), obj_request); if (!osd_req) goto out_unwind; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html