All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Damien.LeMoal@wdc.com, axboe@kernel.dk, linux-block@vger.kernel.org
Cc: bgurney@redhat.com, Jeff Moyer <jmoyer@redhat.com>
Subject: [PATCH 2/2] block: default to deadline for host-managed SMR devices
Date: Fri, 25 May 2018 17:14:32 -0400	[thread overview]
Message-ID: <20180525211432.20359-3-jmoyer@redhat.com> (raw)
In-Reply-To: <20180525211432.20359-1-jmoyer@redhat.com>

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 <bgurney@redhat.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 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);
-- 
2.8.2.335.g4bb51ae

  parent reply	other threads:[~2018-05-25 21:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-25 21:14 [PATCH 0/2][RFC] block: default to deadline for SMR devices Jeff Moyer
2018-05-25 21:14 ` [PATCH 1/2] block: __elevator_change: add try_loading parameter Jeff Moyer
2018-05-25 21:14 ` Jeff Moyer [this message]
2018-05-25 22:04 ` [PATCH 0/2][RFC] block: default to deadline for SMR devices Jens Axboe
2018-05-25 22:18   ` Jeff Moyer
2018-05-26  4:01     ` Jens Axboe
2018-05-29 12:14       ` Bryan Gurney
2018-05-30  6:22       ` Damien Le Moal
2018-05-30  8:47         ` Christoph Hellwig
2018-05-31  5:36           ` Damien Le Moal
2018-05-30 13:45         ` Bryan Gurney
2018-05-30  8:49       ` Christoph Hellwig
2018-05-30 14:22         ` Jens Axboe
2018-05-30 15:06           ` Jeff Moyer
2018-05-30 15:17             ` Jens Axboe
2018-05-30 15:45               ` Jeff Moyer
2018-05-30 15:52                 ` Jens Axboe
2018-05-31  3:16                   ` Damien Le Moal
2018-05-31  3:04                 ` Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180525211432.20359-3-jmoyer@redhat.com \
    --to=jmoyer@redhat.com \
    --cc=Damien.LeMoal@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=bgurney@redhat.com \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.