static bool __rbd_img_handle_request(struct rbd_img_request *img_req,
				     int *result)
{
	struct rbd_device *rbd_dev = img_req->rbd_dev;
	bool done;

	if (need_exclusive_lock(img_req)) {
		down_read(&rbd_dev->lock_rwsem);
		mutex_lock(&img_req->state_mutex);
		done = rbd_img_advance(img_req, result);
		if (done)
			rbd_lock_del_request(img_req);
		mutex_unlock(&img_req->state_mutex);
		up_read(&rbd_dev->lock_rwsem);
	} else {
		mutex_lock(&img_req->state_mutex);
		done = rbd_img_advance(img_req, result);
		mutex_unlock(&img_req->state_mutex);
	}

	if (done && *result) {
		rbd_assert(*result < 0);
		rbd_warn(rbd_dev, "%s%s result %d",
		      test_bit(IMG_REQ_CHILD, &img_req->flags) ? "child " : "",
		      obj_op_name(img_req->op_type), *result);
	}
	return done;
}
static bool __rbd_img_handle_request(struct rbd_img_request *img_req,
				     int *result)
{
	struct rbd_device *rbd_dev = img_req->rbd_dev;
	bool done;

	if (need_exclusive_lock(img_req)) {
		down_read(&rbd_dev->lock_rwsem);
		mutex_lock(&img_req->state_mutex);
		done = rbd_img_advance(img_req, result);
		if (done)
			rbd_lock_del_request(img_req);
		mutex_unlock(&img_req->state_mutex);
		up_read(&rbd_dev->lock_rwsem);
	} else {
		mutex_lock(&img_req->state_mutex);
		done = rbd_img_advance(img_req, result);
		mutex_unlock(&img_req->state_mutex);
	}

	if (done && *result) {
		rbd_assert(*result < 0);
		rbd_warn(rbd_dev, "%s%s result %d",
		      test_bit(IMG_REQ_CHILD, &img_req->flags) ? "child " : "",
		      obj_op_name(img_req->op_type), *result);
	}
	return done;
}