From patchwork Mon Jan 8 19:15:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 10150403 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 D6ADD601A1 for ; Mon, 8 Jan 2018 19:17:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFA7828639 for ; Mon, 8 Jan 2018 19:17:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D445728687; Mon, 8 Jan 2018 19:17:25 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 8E75728639 for ; Mon, 8 Jan 2018 19:17:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932479AbeAHTQF (ORCPT ); Mon, 8 Jan 2018 14:16:05 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:34663 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932365AbeAHTQA (ORCPT ); Mon, 8 Jan 2018 14:16:00 -0500 Received: by mail-qt0-f196.google.com with SMTP id 33so14968818qtv.1; Mon, 08 Jan 2018 11:15:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ex0Ze/kcnHsOhRMLE9UrXd+cNPHUpiExTqrj4yg4ylc=; b=lKAVtgpzEttCdRELf/6DiUoiilpz31rtxwAfQwUfs6L+K3hrw03NQr8zFqTlyokVeO ymJM7qt7Ml9sDpawglv5nuvLiniw87fbpv65xhfUuKDvRm9d3KDuPc2Xw2JivDXlzq2o dC+yyz20h6diP1w4dYZX3ZmsIvfWieduNpSCud4bLmgvfTPjq7XjkzK/nh+w7KL7zi5W 5Gq2rADffurOWNe15e0dl+VPB8p/XSifRXGXME2yOP+sCuv00TeyGtrUp0MD0LCw8mMv D2Soq7sJgyeFMMVvQpmkWUvfOOvfm3dwMU1uE8hV1TV+tN1ETmeOOikkcLt8SpvMmfzQ gsNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ex0Ze/kcnHsOhRMLE9UrXd+cNPHUpiExTqrj4yg4ylc=; b=rakvBlSxcvHyaxK3uTB/wsvW9PQu9Vg77B0DbWcPKs6iIa4LuS1UPPl4EKfEk9kII2 JeY3F8MuLrnu71mN3kRBABIK/sqJJlMpCx+EpYTEc2btKS3U+JXAWh9HFQa/s8Njl6wM 67wstdwJ0Dg/m2BX4cJxypYw7tvYcek69ju6sjPGgP1Md+TqUWgnbM9WFtBZieUsYeTa miSHzZ6eLEMldw9c0H2T+mp/lfX+COW51MZu3WXBlfkaz9ypapiRd6PVQwWGP34cSyfB pQst1t1r1PAZ3FFKlRv2iV//NWpq0CNxkuQMBlJUTc0MXjRfQAHNCSQGrhUeZKxqoOWD 8aOw== X-Gm-Message-State: AKwxytf1dkSCL+hCjqlmblunmaPUXVX+E+Skj9XhgIih/+qvPWhxuz+W eUFzrXrm23Mj+SUGDtp2qVk= X-Google-Smtp-Source: ACJfBotmn6Jw3NtrP7lt4S1YpG4JPvXZZoirqmtUN5Fv94rGKe8In4qWaiu6BgoXK2Be/E0T/Gdu2w== X-Received: by 10.237.59.69 with SMTP id q5mr17737132qte.222.1515438959268; Mon, 08 Jan 2018 11:15:59 -0800 (PST) Received: from localhost (dhcp-ec-8-6b-ed-7a-cf.cpe.echoes.net. [72.28.5.223]) by smtp.gmail.com with ESMTPSA id s43sm8047059qta.49.2018.01.08.11.15.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Jan 2018 11:15:58 -0800 (PST) From: Tejun Heo To: jack@suse.cz, axboe@kernel.dk, clm@fb.com, jbacik@fb.com Cc: kernel-team@fb.com, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, peterz@infradead.org, jianchao.w.wang@oracle.com, Bart.VanAssche@wdc.com, linux-block@vger.kernel.org, Tejun Heo Subject: [PATCH 4/8] blk-mq: use blk_mq_rq_state() instead of testing REQ_ATOM_COMPLETE Date: Mon, 8 Jan 2018 11:15:38 -0800 Message-Id: <20180108191542.379478-5-tj@kernel.org> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180108191542.379478-1-tj@kernel.org> References: <20180108191542.379478-1-tj@kernel.org> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP blk_mq_check_inflight() and blk_mq_poll_hybrid_sleep() test REQ_ATOM_COMPLETE to determine the request state. Both uses are speculative and we can test REQ_ATOM_STARTED and blk_mq_rq_state() for equivalent results. Replace the tests. This will allow removing REQ_ATOM_COMPLETE usages from blk-mq. Signed-off-by: Tejun Heo Reviewed-by: Bart Van Assche --- block/blk-mq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 6587f0c..41bfd27 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -95,8 +95,7 @@ static void blk_mq_check_inflight(struct blk_mq_hw_ctx *hctx, { struct mq_inflight *mi = priv; - if (test_bit(REQ_ATOM_STARTED, &rq->atomic_flags) && - !test_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags)) { + if (blk_mq_rq_state(rq) == MQ_RQ_IN_FLIGHT) { /* * index[0] counts the specific partition that was asked * for. index[1] counts the ones that are active on the @@ -3017,7 +3016,8 @@ static bool blk_mq_poll_hybrid_sleep(struct request_queue *q, hrtimer_init_sleeper(&hs, current); do { - if (test_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags)) + if (test_bit(REQ_ATOM_STARTED, &rq->atomic_flags) && + blk_mq_rq_state(rq) != MQ_RQ_IN_FLIGHT) break; set_current_state(TASK_UNINTERRUPTIBLE); hrtimer_start_expires(&hs.timer, mode);