From 8900c94a4915a5bbcdd78bf986445b74b7e1d201 Mon Sep 17 00:00:00 2001
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Wed, 29 Jul 2015 04:23:43 -0500
Subject: [PATCH] rbd: add write test helper
References: fate#318836
Patch-mainline: Not yet, SES2 clustered LIO/RBD
The next patches add a couple new commands that have write data.
This patch adds a helper to combine all the IMG_REQ write tests.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Acked-by: David Disseldorp <ddiss@suse.de>
---
drivers/block/rbd.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1751,6 +1751,12 @@ static bool img_request_layered_test(str
return test_bit(IMG_REQ_LAYERED, &img_request->flags) != 0;
}
+static bool img_request_is_write_type_test(struct rbd_img_request *img_request)
+{
+ return img_request_write_test(img_request) ||
+ img_request_discard_test(img_request);
+}
+
static enum obj_operation_type
rbd_img_request_op_type(struct rbd_img_request *img_request)
{
@@ -2053,8 +2059,7 @@ rbd_osd_req_create_copyup(struct rbd_obj
rbd_assert(obj_request_img_data_test(obj_request));
img_request = obj_request->img_request;
rbd_assert(img_request);
- rbd_assert(img_request_write_test(img_request) ||
- img_request_discard_test(img_request));
+ rbd_assert(img_request_is_write_type_test(img_request));
if (img_request_discard_test(img_request))
num_osd_ops = 2;
@@ -2254,8 +2259,7 @@ static void rbd_img_request_destroy(stru
rbd_dev_parent_put(img_request->rbd_dev);
}
- if (img_request_write_test(img_request) ||
- img_request_discard_test(img_request))
+ if (img_request_is_write_type_test(img_request))
ceph_put_snap_context(img_request->snapc);
kmem_cache_free(rbd_img_request_cache, img_request);
@@ -2933,8 +2937,7 @@ static bool img_obj_request_simple(struc
struct rbd_device *rbd_dev = img_request->rbd_dev;
/* Reads */
- if (!img_request_write_test(img_request) &&
- !img_request_discard_test(img_request))
+ if (!img_request_is_write_type_test(img_request))
return true;
/* Non-layered writes */