From patchwork Wed Oct 18 07:14:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Christie X-Patchwork-Id: 10013825 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 A3166603FF for ; Wed, 18 Oct 2017 07:14:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96B2C285DB for ; Wed, 18 Oct 2017 07:14:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8AFC2285E5; Wed, 18 Oct 2017 07:14:30 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 BF262285DC for ; Wed, 18 Oct 2017 07:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761382AbdJRHO1 (ORCPT ); Wed, 18 Oct 2017 03:14:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34274 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761716AbdJRHOZ (ORCPT ); Wed, 18 Oct 2017 03:14:25 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1CBB4267F2; Wed, 18 Oct 2017 07:14:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1CBB4267F2 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=mchristi@redhat.com Received: from rh2.redhat.com (ovpn-120-106.rdu2.redhat.com [10.10.120.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60F187BA36; Wed, 18 Oct 2017 07:14:24 +0000 (UTC) From: Mike Christie To: lixiubo@cmss.chinamobile.com, target-devel@vger.kernel.org, nab@linux-iscsi.org Cc: Mike Christie Subject: [PATCH 08/17] tcmu: drop is_in_waiter_list Date: Wed, 18 Oct 2017 02:14:03 -0500 Message-Id: <1508310852-15366-9-git-send-email-mchristi@redhat.com> In-Reply-To: <1508310852-15366-1-git-send-email-mchristi@redhat.com> References: <1508310852-15366-1-git-send-email-mchristi@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 18 Oct 2017 07:14:25 +0000 (UTC) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP No need for the wrapper. Signed-off-by: Mike Christie --- drivers/target/target_core_user.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 0c71572..8a22d60 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c @@ -343,11 +343,6 @@ static struct genl_family tcmu_genl_family __ro_after_init = { #define tcmu_cmd_set_dbi(cmd, index) ((cmd)->dbi[(cmd)->dbi_cur++] = (index)) #define tcmu_cmd_get_dbi(cmd) ((cmd)->dbi[(cmd)->dbi_cur++]) -static inline bool is_in_waiter_list(struct tcmu_dev *udev) -{ - return !!udev->waiting_blocks; -} - static void tcmu_cmd_free_data(struct tcmu_cmd *tcmu_cmd, uint32_t len) { struct tcmu_dev *udev = tcmu_cmd->tcmu_dev; @@ -844,7 +839,6 @@ tcmu_queue_cmd_ring(struct tcmu_cmd *tcmu_cmd) while (!is_ring_space_avail(udev, tcmu_cmd, command_size, data_length)) { int ret; - bool is_waiting_blocks = is_in_waiter_list(udev); DEFINE_WAIT(__wait); prepare_to_wait(&udev->wait_cmdr, &__wait, TASK_INTERRUPTIBLE); @@ -854,7 +848,7 @@ tcmu_queue_cmd_ring(struct tcmu_cmd *tcmu_cmd) * Try to insert the current udev to waiter list and * then wake up the unmap thread */ - if (is_waiting_blocks) { + if (udev->waiting_blocks) { spin_lock(&root_udev_waiter_lock); if (list_empty(&udev->waiter)) list_add_tail(&udev->waiter, &root_udev_waiter); @@ -1184,7 +1178,7 @@ static int tcmu_irqcontrol(struct uio_info *info, s32 irq_on) * make sure that the other waiters in list be fed ahead * of it. */ - if (is_in_waiter_list(tcmu_dev)) { + if (tcmu_dev->waiting_blocks) { wake_up(&unmap_wait); } else { tcmu_handle_completions(tcmu_dev); @@ -2050,7 +2044,7 @@ static uint32_t find_free_blocks(void) tcmu_handle_completions(udev); /* Skip the udevs waiting the global pool or in idle */ - if (is_in_waiter_list(udev) || !udev->dbi_thresh) { + if (udev->waiting_blocks || !udev->dbi_thresh) { mutex_unlock(&udev->cmdr_lock); continue; }