From patchwork Wed Jan 10 00:29:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 10153727 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 C2D6460223 for ; Wed, 10 Jan 2018 00:29:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B4925204FB for ; Wed, 10 Jan 2018 00:29:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A967F26CFF; Wed, 10 Jan 2018 00:29:39 +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,DKIM_SIGNED, DKIM_VALID,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 3432A204FB for ; Wed, 10 Jan 2018 00:29:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754110AbeAJA3i (ORCPT ); Tue, 9 Jan 2018 19:29:38 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:38098 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753742AbeAJA3i (ORCPT ); Tue, 9 Jan 2018 19:29:38 -0500 Received: by mail-pg0-f68.google.com with SMTP id t67so9352628pgc.5 for ; Tue, 09 Jan 2018 16:29:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bcO26nJT5r5e323NduJ2us7pSK7m2BhDqrEhpaIPU1Y=; b=giXQPGDOf/qJB4LCvANgkqJaRYGf2D7aIIQLgZr8K5npfCS737yoIKo9T8UMcTbiVc VM8A7Bgy1TsyXxd08OS2BGgpk6qNCoKgnFfCvrjxIjtSNYBVTlfRndHbaWGEWzqbTpHO NTqnpLda2wkyoxs+QOtVJ5e0iU+lKUwhEm4R5yS5ck56I5pwCD/X/zq5quj35BmP65oT H/08eBaxlRXjXXTrf7Waa79FbSgJjxCs2krbS8kcWdgzB4Z54294EDuPqSohkXoKQuFQ 2AFbYd+/IQERT+pEBQuxkDAHJ5jtjxMotFXFO8VjjnqE4qIS5hgBSyEBumVGt6VEqHl4 Qqdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bcO26nJT5r5e323NduJ2us7pSK7m2BhDqrEhpaIPU1Y=; b=FylF7ay2aY/z+Bt4sVLFiP4TJIqJ/++ZHYy0hTvP6x1glagJL5bPwQRNbXUOPVsm00 z5yT62ZlpBfgBHmSvGNVFhSQDDm/vZ8tquIBskp8phKBMyIMBS2CqXSMvu2sku3OtR9t TJj3/OeCVK7qLaTsv7VMqGkH1XJ36g4ICtiYVcX6z4CgOW07vDuj02a/K3a/tXtwptNz 5Mtcb7157lFPQKLpwlVn69tE7cbACPBm3GmLxI52uB3zuDdj0d5rKbcsh8/yUEQ1qjg5 kBIklm78Q+weX3LMBi7Qn6nL4NR6BzYxVIq9r+JKliWNHmuq9nwrkhqzqULVJpk3xJ7x E9OQ== X-Gm-Message-State: AKGB3mJSXm77//A2X2JTKdCmhMvxYkdUfqkmJVUxhw+bka6/ta03/LB6 WOCMpXKDwClRYH4V0+2HFIPHWFIzyks= X-Google-Smtp-Source: ACJfBouGqhYGQQLgKRPLE9k19RK99Yoyn+YgErE6uq9jNt8XuZzz/Smj8USbUdHcJgxo+YS7eATHCw== X-Received: by 10.99.141.193 with SMTP id z184mr7502999pgd.261.1515544177206; Tue, 09 Jan 2018 16:29:37 -0800 (PST) Received: from localhost.localdomain ([2600:380:766f:e75f:6460:472b:91a3:2f8b]) by smtp.gmail.com with ESMTPSA id v23sm31056239pfe.72.2018.01.09.16.29.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Jan 2018 16:29:36 -0800 (PST) From: Jens Axboe To: linux-block@vger.kernel.org Cc: osandov@fb.com, bart.vanassche@wdc.com, Jens Axboe Subject: [PATCH 3/4] block: convert REQ_ATOM_COMPLETE to stealing rq->__deadline bit Date: Tue, 9 Jan 2018 17:29:26 -0700 Message-Id: <1515544167-10751-4-git-send-email-axboe@kernel.dk> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515544167-10751-1-git-send-email-axboe@kernel.dk> References: <1515544167-10751-1-git-send-email-axboe@kernel.dk> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We only have one atomic flag left. Instead of using an entire unsigned long for that, steal the bottom bit of the deadline field that we already reserved. Remove ->atomic_flags, since it's now unused. Signed-off-by: Jens Axboe --- block/blk-core.c | 2 +- block/blk-mq-debugfs.c | 8 -------- block/blk-mq.c | 2 +- block/blk.h | 19 +++++++++---------- include/linux/blkdev.h | 2 -- 5 files changed, 11 insertions(+), 22 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index f843ae4f858d..7ba607527487 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -2853,7 +2853,7 @@ void blk_start_request(struct request *req) wbt_issue(req->q->rq_wb, &req->issue_stat); } - BUG_ON(test_bit(REQ_ATOM_COMPLETE, &req->atomic_flags)); + BUG_ON(blk_rq_is_complete(req)); blk_add_timer(req); } EXPORT_SYMBOL(blk_start_request); diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 2a9c9f8b6162..ac99b78415ec 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -291,12 +291,6 @@ static const char *const rqf_name[] = { }; #undef RQF_NAME -#define RQAF_NAME(name) [REQ_ATOM_##name] = #name -static const char *const rqaf_name[] = { - RQAF_NAME(COMPLETE), -}; -#undef RQAF_NAME - int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq) { const struct blk_mq_ops *const mq_ops = rq->q->mq_ops; @@ -313,8 +307,6 @@ int __blk_mq_debugfs_rq_show(struct seq_file *m, struct request *rq) seq_puts(m, ", .rq_flags="); blk_flags_show(m, (__force unsigned int)rq->rq_flags, rqf_name, ARRAY_SIZE(rqf_name)); - seq_puts(m, ", .atomic_flags="); - blk_flags_show(m, rq->atomic_flags, rqaf_name, ARRAY_SIZE(rqaf_name)); seq_printf(m, ", .tag=%d, .internal_tag=%d", rq->tag, rq->internal_tag); if (mq_ops->show_rq) diff --git a/block/blk-mq.c b/block/blk-mq.c index d875c51bcff8..7248ee043651 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -294,7 +294,6 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, rq->rq_flags |= RQF_PREEMPT; if (blk_queue_io_stat(data->q)) rq->rq_flags |= RQF_IO_STAT; - /* do not touch atomic flags, it needs atomic ops against the timer */ rq->cpu = -1; INIT_HLIST_NODE(&rq->hash); RB_CLEAR_NODE(&rq->rb_node); @@ -313,6 +312,7 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, rq->special = NULL; /* tag was already set */ rq->extra_len = 0; + rq->__deadline = 0; INIT_LIST_HEAD(&rq->timeout_list); rq->timeout = 0; diff --git a/block/blk.h b/block/blk.h index bcd9cf7db0d4..c84ae0e21ebd 100644 --- a/block/blk.h +++ b/block/blk.h @@ -120,24 +120,23 @@ void blk_account_io_completion(struct request *req, unsigned int bytes); void blk_account_io_done(struct request *req); /* - * Internal atomic flags for request handling - */ -enum rq_atomic_flags { - REQ_ATOM_COMPLETE = 0, -}; - -/* * EH timer and IO completion will both attempt to 'grab' the request, make - * sure that only one of them succeeds + * sure that only one of them succeeds. Steal the bottom bit of the + * __deadline field for this. */ static inline int blk_mark_rq_complete(struct request *rq) { - return test_and_set_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags); + return test_and_set_bit(0, &rq->__deadline); } static inline void blk_clear_rq_complete(struct request *rq) { - clear_bit(REQ_ATOM_COMPLETE, &rq->atomic_flags); + clear_bit(0, &rq->__deadline); +} + +static inline bool blk_rq_is_complete(struct request *rq) +{ + return test_bit(0, &rq->__deadline); } /* diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index aa6698cf483c..d4b2f7bb18d6 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -156,8 +156,6 @@ struct request { int internal_tag; - unsigned long atomic_flags; - /* the following two fields are internal, NEVER access directly */ unsigned int __data_len; /* total data len */ int tag;