From patchwork Wed Jul 29 09:23:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 6891291 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C95BBC05AC for ; Wed, 29 Jul 2015 09:24:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E98AC207D8 for ; Wed, 29 Jul 2015 09:24:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F2A32207B1 for ; Wed, 29 Jul 2015 09:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752551AbbG2JYD (ORCPT ); Wed, 29 Jul 2015 05:24:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56535 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751643AbbG2JYA (ORCPT ); Wed, 29 Jul 2015 05:24:00 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 852799C0AA; Wed, 29 Jul 2015 09:24:00 +0000 (UTC) Received: from rh2.redhat.com (vpn-60-109.rdu2.redhat.com [10.10.60.109]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t6T9Ntmj011149; Wed, 29 Jul 2015 05:23:59 -0400 From: mchristi@redhat.com To: ceph-devel@vger.kernel.org, target-devel@vger.kernel.org Subject: [PATCH 06/18] rbd: add write test helper Date: Wed, 29 Jul 2015 04:23:43 -0500 Message-Id: <1438161835-27960-6-git-send-email-mchristi@redhat.com> In-Reply-To: <1438161835-27960-1-git-send-email-mchristi@redhat.com> References: <1438161835-27960-1-git-send-email-mchristi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mike Christie 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 --- drivers/block/rbd.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 1df7bdd..8d0b30a 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1739,6 +1739,12 @@ static bool img_request_layered_test(struct rbd_img_request *img_request) 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) { @@ -2024,8 +2030,7 @@ rbd_osd_req_create_copyup(struct rbd_obj_request *obj_request) 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; @@ -2259,8 +2264,7 @@ static void rbd_img_request_destroy(struct kref *kref) 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); @@ -2977,8 +2981,7 @@ static bool img_obj_request_simple(struct rbd_obj_request *obj_request) 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 */