static int __rbd_img_fill_request(struct rbd_img_request *img_req)
{
	struct rbd_obj_request *obj_req, *next_obj_req;
	int ret;

	for_each_obj_request_safe(img_req, obj_req, next_obj_req) {
		switch (img_req->op_type) {
		case OBJ_OP_READ:
			ret = rbd_obj_init_read(obj_req);
			break;
		case OBJ_OP_WRITE:
			ret = rbd_obj_init_write(obj_req);
			break;
		case OBJ_OP_DISCARD:
			ret = rbd_obj_init_discard(obj_req);
			break;
		case OBJ_OP_ZEROOUT:
			ret = rbd_obj_init_zeroout(obj_req);
			break;
		default:
			BUG();
		}
		if (ret < 0)
			return ret;
		if (ret > 0) {
			rbd_img_obj_request_del(img_req, obj_req);
			continue;
		}
	}

	img_req->state = RBD_IMG_START;
	return 0;
}
static int __rbd_img_fill_request(struct rbd_img_request *img_req)
{
	struct rbd_obj_request *obj_req, *next_obj_req;
	int ret;

	for_each_obj_request_safe(img_req, obj_req, next_obj_req) {
		switch (img_req->op_type) {
		case OBJ_OP_READ:
			ret = rbd_obj_init_read(obj_req);
			break;
		case OBJ_OP_WRITE:
			ret = rbd_obj_init_write(obj_req);
			break;
		case OBJ_OP_DISCARD:
			ret = rbd_obj_init_discard(obj_req);
			break;
		case OBJ_OP_ZEROOUT:
			ret = rbd_obj_init_zeroout(obj_req);
			break;
		default:
			BUG();
		}
		if (ret < 0)
			return ret;
		if (ret > 0) {
			rbd_img_obj_request_del(img_req, obj_req);
			continue;
		}
	}

	img_req->state = RBD_IMG_START;
	return 0;
}