From patchwork Thu Sep 27 01:55:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 10617149 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA5E014BD for ; Thu, 27 Sep 2018 01:55:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA38A2B03C for ; Thu, 27 Sep 2018 01:55:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E5732B06C; Thu, 27 Sep 2018 01:55: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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 31ADF2B045 for ; Thu, 27 Sep 2018 01:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727171AbeI0ILN (ORCPT ); Thu, 27 Sep 2018 04:11:13 -0400 Received: from esa2.hgst.iphmx.com ([68.232.143.124]:17768 "EHLO esa2.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727116AbeI0ILN (ORCPT ); Thu, 27 Sep 2018 04:11:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1538013375; x=1569549375; h=from:to:cc:subject:date:message-id; bh=dOidkR6pX8M5FK6EMJQibz13xxplaF/uiI4u88N2a9o=; b=j2b9/yTB7pi8wyzthSYNcsVXT/K8Eq5cbA1Pxm7Gpk8L7itDwB69N7Vb +0W48Vz0BYEUQ0Ymi2FjfHwe9Q3UZAabY+iVPU71qpOx9ZGKmSZiVfT+K fZqQLFsB/bsrfY8yWRLEiduKjIr+zVoaCGU1NNPGuQnbD45+aPX4HGx3U 9N2y/b4+rFJMniXNcFCFTQCeIh9GQ2a1FzmBTtxn7POtjX9ne2vZdGMPY WPNa3hjWQIIfULKljVVoFBKqJtI7n8B2JJ+uYNzpDHUvVBAAxKWu+3brx OfIFgb0ymJ941YIcafvgzqbRjtH6yBXOMty/IhfZfuMucZYuTCGZUVE10 Q==; X-IronPort-AV: E=Sophos;i="5.54,308,1534780800"; d="scan'208";a="188292543" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 27 Sep 2018 09:56:15 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP; 26 Sep 2018 18:41:13 -0700 Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 26 Sep 2018 18:55:22 -0700 From: Damien Le Moal To: linux-block@vger.kernel.org, Jens Axboe Cc: Bart Van Assche , Johannes Thumshirn , stable@vger.kernel.org Subject: [PATCH v3] block: fix deadline elevator drain for zoned block devices Date: Thu, 27 Sep 2018 10:55:13 +0900 Message-Id: <20180927015513.24020-1-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.17.1 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 When the deadline scheduler is used with a zoned block device, writes to a zone will be dispatched one at a time. This causes the warning message: deadline: forced dispatching is broken (nr_sorted=X), please report this to be displayed when switching to another elevator with the legacy I/O path while write requests to a zone are being retained in the scheduler queue. Prevent this message from being displayed when executing elv_drain_elevator() for a zoned block device. __blk_drain_queue() will loop until all writes are dispatched and completed, resulting in the desired elevator queue drain without extensive modifications to the deadline code itself to handle forced-dispatch calls. Signed-off-by: Damien Le Moal Fixes: 8dc8146f9c92 ("deadline-iosched: Introduce zone locking support") Cc: stable@vger.kernel.org --- Changes from v2: * Move zoned block device test before 'printed' increment as suggested by Bart * Added "Fixes" tag and cc stable Changes from v1: * Fixed typo in commit message block/elevator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/elevator.c b/block/elevator.c index 6a06b5d040e5..fae58b2f906f 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -609,7 +609,7 @@ void elv_drain_elevator(struct request_queue *q) while (e->type->ops.sq.elevator_dispatch_fn(q, 1)) ; - if (q->nr_sorted && printed++ < 10) { + if (q->nr_sorted && !blk_queue_is_zoned(q) && printed++ < 10 ) { printk(KERN_ERR "%s: forced dispatching is broken " "(nr_sorted=%u), please report this\n", q->elevator->type->elevator_name, q->nr_sorted);