From patchwork Fri Mar 24 12:36:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9642781 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 06CD260327 for ; Fri, 24 Mar 2017 12:36:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0264E27F07 for ; Fri, 24 Mar 2017 12:36:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB6832823E; Fri, 24 Mar 2017 12:36:49 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 E5A4127F07 for ; Fri, 24 Mar 2017 12:36:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934027AbdCXMgs (ORCPT ); Fri, 24 Mar 2017 08:36:48 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:32884 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932434AbdCXMgr (ORCPT ); Fri, 24 Mar 2017 08:36:47 -0400 Received: by mail-pg0-f67.google.com with SMTP id 79so235035pgf.0 for ; Fri, 24 Mar 2017 05:36:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cCN7WiFGX95lzFukRtoc/PjuVTGa8h+3P8kCcli9Jlw=; b=RBaWNfOJlIJJfVOJGpWG62vsRQJMv37G5DBHtQ3VZ+F9OKxmbDwVgeCnRZ1i82F8Vw ZPtY+5qEwRvCpN3vbqvCx4F9WRE4+hR+VigKca5wIc/m/rmlMXMk1OJ/hSPPyntdshUl 1bE/chL49kXa06CIXCybNYXolgxlT+MmdGpLMFBAUcbeCtBvs0VstaZIszyfg9VXcDvb UNycX9hO4T/R2gB5brZ8WpzbrkTP5iszHuirkYBBCGqTgWiNWhMl8dsEsRA8Yw9oks17 LmclbvB/7+WxQN12SgbfH7lutND0rNa3w1f3+K4TQBzcK6CC0rVE+Vl/awdQKL+8Ebhm cCsA== 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=cCN7WiFGX95lzFukRtoc/PjuVTGa8h+3P8kCcli9Jlw=; b=jAwB0JematWTEuxzt5xF3rGhG1iLcl2pUAGEcVqPhu8w7IjzhZ/amzZv4wPKJ9TUKj pO40a/8X8sItPFERB+G/5ZVBJPanACcryvPOTG3xr1HLZF4w1rr8FiykSz3VypgdHTJi xQjxOBJ1HjF39eBjnMaaJjgdPCj1UcvAyv7zmedV3IaTjaB7kpZfSI/dxDMWz/uK4uAV OqU4tFEORHhQcMMXmcY6sQDmMk9o+Ck29fsT0TXY4TBfh0b+LV9irXz2OGr1noPbDYFt pGUhCcsATCatHbZ7cFPj4t5GrN65GD3i2vcRfy8HFGmK56OIjtHY6hZ6fX17Qiw79TZ3 wwzg== X-Gm-Message-State: AFeK/H08/aZCjc054B5eA9ZeXPTk5Unj1JNQTXDV0s5VLB3BoYqWwaac8yej7EGDqPqjNQ== X-Received: by 10.84.230.131 with SMTP id e3mr10912346plk.100.1490359006220; Fri, 24 Mar 2017 05:36:46 -0700 (PDT) Received: from localhost (li405-222.members.linode.com. [106.187.53.222]) by smtp.gmail.com with ESMTPSA id z62sm4628220pff.88.2017.03.24.05.36.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 24 Mar 2017 05:36:45 -0700 (PDT) From: Ming Lei To: Jens Axboe , linux-block@vger.kernel.org, Christoph Hellwig Cc: Bart Van Assche , Hannes Reinecke , Ming Lei Subject: [PATCH v2 3/4] block: rename blk_mq_freeze_queue_start() Date: Fri, 24 Mar 2017 20:36:20 +0800 Message-Id: <20170324123621.5227-4-tom.leiming@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170324123621.5227-1-tom.leiming@gmail.com> References: <20170324123621.5227-1-tom.leiming@gmail.com> 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 As the .q_usage_counter is used by both legacy and mq path, we need to block new I/O if queue becomes dead in blk_queue_enter(). So rename it and we can use this function in both pathes. Signed-off-by: Ming Lei Reviewed-by: Hannes Reinecke Reviewed-by: Bart Van Assche --- block/blk-core.c | 2 +- block/blk-mq.c | 10 +++++----- drivers/block/mtip32xx/mtip32xx.c | 2 +- drivers/nvme/host/core.c | 2 +- include/linux/blk-mq.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 44eed17319c0..5901133d105f 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -670,7 +670,7 @@ int blk_queue_enter(struct request_queue *q, bool nowait) return -EBUSY; /* - * read pair of barrier in blk_mq_freeze_queue_start(), + * read pair of barrier in blk_freeze_queue_start(), * we need to order reading DEAD flag of .q_usage_counter * and reading .mq_freeze_depth, otherwise the following * wait may never return if the two read are reordered. diff --git a/block/blk-mq.c b/block/blk-mq.c index b36f0481ba0e..5370b4f750ff 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -68,7 +68,7 @@ static void blk_mq_hctx_clear_pending(struct blk_mq_hw_ctx *hctx, sbitmap_clear_bit(&hctx->ctx_map, ctx->index_hw); } -void blk_mq_freeze_queue_start(struct request_queue *q) +void blk_freeze_queue_start(struct request_queue *q) { int freeze_depth; @@ -78,7 +78,7 @@ void blk_mq_freeze_queue_start(struct request_queue *q) blk_mq_run_hw_queues(q, false); } } -EXPORT_SYMBOL_GPL(blk_mq_freeze_queue_start); +EXPORT_SYMBOL_GPL(blk_freeze_queue_start); void blk_mq_freeze_queue_wait(struct request_queue *q) { @@ -108,7 +108,7 @@ void blk_freeze_queue(struct request_queue *q) * no blk_unfreeze_queue(), and blk_freeze_queue() is not * exported to drivers as the only user for unfreeze is blk_mq. */ - blk_mq_freeze_queue_start(q); + blk_freeze_queue_start(q); blk_mq_freeze_queue_wait(q); } @@ -746,7 +746,7 @@ static void blk_mq_timeout_work(struct work_struct *work) * percpu_ref_tryget directly, because we need to be able to * obtain a reference even in the short window between the queue * starting to freeze, by dropping the first reference in - * blk_mq_freeze_queue_start, and the moment the last request is + * blk_freeze_queue_start, and the moment the last request is * consumed, marked by the instant q_usage_counter reaches * zero. */ @@ -2376,7 +2376,7 @@ static void blk_mq_queue_reinit_work(void) * take place in parallel. */ list_for_each_entry(q, &all_q_list, all_q_node) - blk_mq_freeze_queue_start(q); + blk_freeze_queue_start(q); list_for_each_entry(q, &all_q_list, all_q_node) blk_mq_freeze_queue_wait(q); diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index f96ab717534c..c96c35ab39df 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -4162,7 +4162,7 @@ static int mtip_block_remove(struct driver_data *dd) dev_info(&dd->pdev->dev, "device %s surprise removal\n", dd->disk->disk_name); - blk_mq_freeze_queue_start(dd->queue); + blk_freeze_queue_start(dd->queue); blk_mq_stop_hw_queues(dd->queue); blk_mq_tagset_busy_iter(&dd->tags, mtip_no_dev_cleanup, dd); diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 9b3b57fef446..4a6d7f408769 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2386,7 +2386,7 @@ void nvme_start_freeze(struct nvme_ctrl *ctrl) mutex_lock(&ctrl->namespaces_mutex); list_for_each_entry(ns, &ctrl->namespaces, list) - blk_mq_freeze_queue_start(ns->queue); + blk_freeze_queue_start(ns->queue); mutex_unlock(&ctrl->namespaces_mutex); } EXPORT_SYMBOL_GPL(nvme_start_freeze); diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index 5b3e201c8d4f..ea2e9dcd3aef 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -243,7 +243,7 @@ void blk_mq_tagset_busy_iter(struct blk_mq_tag_set *tagset, busy_tag_iter_fn *fn, void *priv); void blk_mq_freeze_queue(struct request_queue *q); void blk_mq_unfreeze_queue(struct request_queue *q); -void blk_mq_freeze_queue_start(struct request_queue *q); +void blk_freeze_queue_start(struct request_queue *q); void blk_mq_freeze_queue_wait(struct request_queue *q); int blk_mq_freeze_queue_wait_timeout(struct request_queue *q, unsigned long timeout);