提交 058aa991 编写于 作者: I Ilya Dryomov

rbd: clean up asserts in rbd_img_obj_request_submit() helpers

Assert once in rbd_img_obj_request_submit().
Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
Reviewed-by: NAlex Elder <elder@linaro.org>
Reviewed-by: NDavid Disseldorp <ddiss@suse.de>
上级 980917fc
...@@ -2747,21 +2747,14 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request) ...@@ -2747,21 +2747,14 @@ rbd_img_obj_parent_read_full_callback(struct rbd_img_request *img_request)
*/ */
static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request) static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
{ {
struct rbd_img_request *img_request = NULL; struct rbd_device *rbd_dev = obj_request->img_request->rbd_dev;
struct rbd_img_request *parent_request = NULL; struct rbd_img_request *parent_request = NULL;
struct rbd_device *rbd_dev;
u64 img_offset; u64 img_offset;
u64 length; u64 length;
struct page **pages = NULL; struct page **pages = NULL;
u32 page_count; u32 page_count;
int result; int result;
rbd_assert(obj_request_img_data_test(obj_request));
rbd_assert(obj_request_type_valid(obj_request->type));
img_request = obj_request->img_request;
rbd_assert(img_request != NULL);
rbd_dev = img_request->rbd_dev;
rbd_assert(rbd_dev->parent != NULL); rbd_assert(rbd_dev->parent != NULL);
/* /*
...@@ -2802,10 +2795,11 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request) ...@@ -2802,10 +2795,11 @@ static int rbd_img_obj_parent_read_full(struct rbd_obj_request *obj_request)
result = rbd_img_request_fill(parent_request, OBJ_REQUEST_PAGES, pages); result = rbd_img_request_fill(parent_request, OBJ_REQUEST_PAGES, pages);
if (result) if (result)
goto out_err; goto out_err;
parent_request->copyup_pages = pages; parent_request->copyup_pages = pages;
parent_request->copyup_page_count = page_count; parent_request->copyup_page_count = page_count;
parent_request->callback = rbd_img_obj_parent_read_full_callback; parent_request->callback = rbd_img_obj_parent_read_full_callback;
result = rbd_img_request_submit(parent_request); result = rbd_img_request_submit(parent_request);
if (!result) if (!result)
return 0; return 0;
...@@ -2891,8 +2885,8 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request) ...@@ -2891,8 +2885,8 @@ static void rbd_img_obj_exists_callback(struct rbd_obj_request *obj_request)
static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request) static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
{ {
struct rbd_device *rbd_dev = obj_request->img_request->rbd_dev;
struct rbd_obj_request *stat_request; struct rbd_obj_request *stat_request;
struct rbd_device *rbd_dev;
struct page **pages = NULL; struct page **pages = NULL;
u32 page_count; u32 page_count;
size_t size; size_t size;
...@@ -2923,8 +2917,6 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request) ...@@ -2923,8 +2917,6 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
stat_request->pages = pages; stat_request->pages = pages;
stat_request->page_count = page_count; stat_request->page_count = page_count;
rbd_assert(obj_request->img_request);
rbd_dev = obj_request->img_request->rbd_dev;
stat_request->osd_req = rbd_osd_req_create(rbd_dev, OBJ_OP_READ, 1, stat_request->osd_req = rbd_osd_req_create(rbd_dev, OBJ_OP_READ, 1,
stat_request); stat_request);
if (!stat_request->osd_req) if (!stat_request->osd_req)
...@@ -2948,14 +2940,8 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request) ...@@ -2948,14 +2940,8 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request)
static bool img_obj_request_simple(struct rbd_obj_request *obj_request) static bool img_obj_request_simple(struct rbd_obj_request *obj_request)
{ {
struct rbd_img_request *img_request; struct rbd_img_request *img_request = obj_request->img_request;
struct rbd_device *rbd_dev; struct rbd_device *rbd_dev = img_request->rbd_dev;
rbd_assert(obj_request_img_data_test(obj_request));
img_request = obj_request->img_request;
rbd_assert(img_request);
rbd_dev = img_request->rbd_dev;
/* Reads */ /* Reads */
if (!img_request_write_test(img_request) && if (!img_request_write_test(img_request) &&
...@@ -2994,6 +2980,10 @@ static bool img_obj_request_simple(struct rbd_obj_request *obj_request) ...@@ -2994,6 +2980,10 @@ static bool img_obj_request_simple(struct rbd_obj_request *obj_request)
static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request) static int rbd_img_obj_request_submit(struct rbd_obj_request *obj_request)
{ {
rbd_assert(obj_request_img_data_test(obj_request));
rbd_assert(obj_request_type_valid(obj_request->type));
rbd_assert(obj_request->img_request);
if (img_obj_request_simple(obj_request)) { if (img_obj_request_simple(obj_request)) {
rbd_obj_request_submit(obj_request); rbd_obj_request_submit(obj_request);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册