From patchwork Mon Sep 19 17:03:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9339915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9EC0F607D0 for ; Mon, 19 Sep 2016 17:03:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CF7E295C7 for ; Mon, 19 Sep 2016 17:03:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81980295DD; Mon, 19 Sep 2016 17:03:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EF4F295C7 for ; Mon, 19 Sep 2016 17:03:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752433AbcISRDr (ORCPT ); Mon, 19 Sep 2016 13:03:47 -0400 Received: from mail-yw0-f195.google.com ([209.85.161.195]:35416 "EHLO mail-yw0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752315AbcISRDp (ORCPT ); Mon, 19 Sep 2016 13:03:45 -0400 Received: by mail-yw0-f195.google.com with SMTP id u82so8530368ywc.2 for ; Mon, 19 Sep 2016 10:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NQn26z/99UYMUF6w+GTkXwTglQDDbz22y7u6iy62abg=; b=FrdtPPLxkdx1TKRPF8QMEQ5zuXxEK2n7dGxNkkzcHiylL7jAJfSLJ5CNX926r0P+X5 CMt4QTkxjVumfd9S24gNQAseGJ2nz0BrGS3XNWiKMMrjdSe4tpDrSRXKM6ncMgt5qeyf UKoAxCtr6Jjp+VcHo0x90+zde2YCC2sCNVLzke1kdmBQyXNdaurnb4vUwKfX+Q62dzpU HYXT87vJf8OxmId3t5a3OD0Kv6hnu5fEu/wQzWeMpEHyjdOE+gl3PwhMGmyi33fZU2dc nb2LGhUG0LaFsDHC13UNTSmIyDFZd83WqOV8HY5kvdxjTD27b2woa7SEmAKYE3Tej541 s/Jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NQn26z/99UYMUF6w+GTkXwTglQDDbz22y7u6iy62abg=; b=enjLmlUI0B6ktz7H4tR/A9t/b62WP6TFL6PtY2LmwCPm0lMtExXNLYTK1s9uF70mQP zjknvdJZp/9sE8rclb5s7ZJnvAqBDigb3C/lf2OHO7t19tbEy17CfpjgQtQ0fIQENvDi 3dGepzSPQlm0tlLdp4nUtuJ1WxRUQiQvwrqOaDWIkA98L+0s2Z1nzcgKiYm+W8JzgkPH /mIDMxJSLCrr3MfjMvor2Y/hZ50YwQ7WfnZ0GfLpPONYF0FaRdTIO2c9v5gnxM9MmlG4 PUFPwDjKer9Ay76TlvD4W2fz4cN9gTcpE5zUXyWq1ZS8khsfrem+Pd0dWU/7OP0E3eGc XV1g== X-Gm-Message-State: AE9vXwM6/l6oU9ftW7SzVLdrnQSRsEIttsHDyQUatVHWzqUMopvUBiQGc0pfWj+8QoIbNQ== X-Received: by 10.129.89.10 with SMTP id n10mr22761588ywb.296.1474304625003; Mon, 19 Sep 2016 10:03:45 -0700 (PDT) Received: from localhost.localdomain.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id o14sm9773905ywd.3.2016.09.19.10.03.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Sep 2016 10:03:44 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Alex Elder Subject: [PATCH 2/8] rbd: clean up asserts in rbd_img_obj_request_submit() helpers Date: Mon, 19 Sep 2016 19:03:22 +0200 Message-Id: <1474304608-17958-3-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1474304608-17958-1-git-send-email-idryomov@gmail.com> References: <1474304608-17958-1-git-send-email-idryomov@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Assert once in rbd_img_obj_request_submit(). Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder Reviewed-by: David Disseldorp --- drivers/block/rbd.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index d8b702e3c4d9..027e0817a118 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2739,21 +2739,14 @@ out_err: */ 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_device *rbd_dev; u64 img_offset; u64 length; struct page **pages = NULL; u32 page_count; 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); /* @@ -2794,10 +2787,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); if (result) goto out_err; + parent_request->copyup_pages = pages; parent_request->copyup_page_count = page_count; - parent_request->callback = rbd_img_obj_parent_read_full_callback; + result = rbd_img_request_submit(parent_request); if (!result) return 0; @@ -2883,8 +2877,8 @@ out: 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_device *rbd_dev; struct page **pages = NULL; u32 page_count; size_t size; @@ -2915,8 +2909,6 @@ static int rbd_img_obj_exists_submit(struct rbd_obj_request *obj_request) stat_request->pages = pages; 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); if (!stat_request->osd_req) @@ -2940,14 +2932,8 @@ out: static bool img_obj_request_simple(struct rbd_obj_request *obj_request) { - struct rbd_img_request *img_request; - struct rbd_device *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; + struct rbd_img_request *img_request = obj_request->img_request; + struct rbd_device *rbd_dev = img_request->rbd_dev; /* Reads */ if (!img_request_write_test(img_request) && @@ -2986,6 +2972,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) { + 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)) { rbd_obj_request_submit(obj_request); return 0;