From patchwork Fri May 25 21:14:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Moyer X-Patchwork-Id: 10428509 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 F2BDD6053B for ; Fri, 25 May 2018 21:15:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E15DB297F2 for ; Fri, 25 May 2018 21:15:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6159297F4; Fri, 25 May 2018 21:15:22 +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.9 required=2.0 tests=BAYES_00, 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 84D0B297F3 for ; Fri, 25 May 2018 21:15:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030216AbeEYVPV (ORCPT ); Fri, 25 May 2018 17:15:21 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42248 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030239AbeEYVPU (ORCPT ); Fri, 25 May 2018 17:15:20 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDB2740122B0; Fri, 25 May 2018 21:15:19 +0000 (UTC) Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.19.60.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id C398810FFE6D; Fri, 25 May 2018 21:15:19 +0000 (UTC) Received: by segfault.boston.devel.redhat.com (Postfix, from userid 3734) id 0B570655F75; Fri, 25 May 2018 17:15:19 -0400 (EDT) From: Jeff Moyer To: Damien.LeMoal@wdc.com, axboe@kernel.dk, linux-block@vger.kernel.org Cc: bgurney@redhat.com, Jeff Moyer Subject: [PATCH 2/2] block: default to deadline for host-managed SMR devices Date: Fri, 25 May 2018 17:14:32 -0400 Message-Id: <20180525211432.20359-3-jmoyer@redhat.com> In-Reply-To: <20180525211432.20359-1-jmoyer@redhat.com> References: <20180525211432.20359-1-jmoyer@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 25 May 2018 21:15:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 25 May 2018 21:15:19 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jmoyer@redhat.com' RCPT:'' 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 Bryan Gurney reported a series of I/O errors resulting from using CFQ with a host-managed SMR disk. After commit 39051dd85f28 ("scsi: sd: Remove zone write locking), which was merged in 4.16, users should use one of the deadline I/O schedulers (unless applications are very careful about only submitting 1 I/O per zone). Change our defaults to provide a working configuration. Reported-by: Bryan Gurney Signed-off-by: Jeff Moyer --- block/blk-sysfs.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index d00d1b0..ec2f29b 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -908,6 +908,30 @@ int blk_register_queue(struct gendisk *disk) return ret; } } + + /* + * Temporary work-around for host-managed SMR devices: right now, + * the deadline I/O schedulers are the only ones that are SMR- + * aware. Use of other schedulers will almost always result + * in I/O errors due to out-of-order writes to zones. For now, + * force deadline if we can. The eventual goal is to get rid + * of this in favor of a dispatch layer that would work with + * all I/O schedulers. + */ + if (blk_queue_zoned_model(q) == BLK_ZONED_HM) { + ret = __elevator_change(q, "deadline", false); + if (ret == 0) + printk("%s: switched to deadline I/O scheduler for " + "host-managed SMR device %s\n", __func__, + disk->disk_name); + else { + printk("%s: warning: unable to switch to SMR-aware " + "deadline I/O scheduler for host-managed SMR " + "device %s\n", __func__, disk->disk_name); + printk("Consider building deadline and mq-deadline " + "into your kernel (not as modules)\n"); + } + } ret = 0; unlock: mutex_unlock(&q->sysfs_lock);