summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2010-10-01 10:57:56 -0700
committerBrian Behlendorf <[email protected]>2010-10-12 14:55:02 -0700
commit2959d94a0a53612cc1ca9ce9d17df26c3d69a513 (patch)
treef4571ef38043563b698daa65e0db62e69de46868 /include
parentc5343ba71b9fea6e3636be25a16173092f2042ba (diff)
Add FAILFAST support
ZFS works best when it is notified as soon as possible when a device failure occurs. This allows it to immediately start any recovery actions which may be needed. In theory Linux supports a flag which can be set on bio's called FAILFAST which provides this quick notification by disabling the retry logic in the lower scsi layers. That's the theory at least. In practice is turns out that while the flag exists you oddly have to set it with the BIO_RW_AHEAD flag. And even when it's set it you may get retries in the low level drivers decides that's the right behavior, or if you don't get the right error codes reported to the scsi midlayer. Unfortunately, without additional kernels patchs there's not much which can be done to improve this. Basically, this just means that it may take 2-3 minutes before a ZFS is notified properly that a device has failed. This can be improved and I suspect I'll be submitting patches upstream to handle this.
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.in1
-rw-r--r--include/sys/Makefile.in1
-rw-r--r--include/sys/blkdev.h32
-rw-r--r--include/sys/fm/Makefile.in1
-rw-r--r--include/sys/fm/fs/Makefile.in1
-rw-r--r--include/sys/fs/Makefile.in1
6 files changed, 37 insertions, 0 deletions
diff --git a/include/Makefile.in b/include/Makefile.in
index 6c351a868..6821a67fe 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -44,6 +44,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-bdev-logical-size.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
+ $(top_srcdir)/config/kernel-bio-failfast.m4 \
$(top_srcdir)/config/kernel-bio-rw-syncio.m4 \
$(top_srcdir)/config/kernel-blk-end-request.m4 \
$(top_srcdir)/config/kernel-blk-fetch-request.m4 \
diff --git a/include/sys/Makefile.in b/include/sys/Makefile.in
index bcadd908a..8964aae41 100644
--- a/include/sys/Makefile.in
+++ b/include/sys/Makefile.in
@@ -44,6 +44,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-bdev-logical-size.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
+ $(top_srcdir)/config/kernel-bio-failfast.m4 \
$(top_srcdir)/config/kernel-bio-rw-syncio.m4 \
$(top_srcdir)/config/kernel-blk-end-request.m4 \
$(top_srcdir)/config/kernel-blk-fetch-request.m4 \
diff --git a/include/sys/blkdev.h b/include/sys/blkdev.h
index b84f66aed..7102890f1 100644
--- a/include/sys/blkdev.h
+++ b/include/sys/blkdev.h
@@ -202,6 +202,38 @@ struct req_iterator {
bio_for_each_segment(bvl, _iter.bio, _iter.i)
#endif /* HAVE_RQ_FOR_EACH_SEGMENT */
+static inline void
+bio_set_flags_failfast(struct block_device *bdev, int *flags)
+{
+#ifdef HAVE_BIO_RW_FAILFAST
+ /*
+ * Disable BIO_RW_FAILFAST_* for loopback devices because of
+ * the following incorrect BUG_ON() in loop_make_request().
+ * This support is also disabled for md devices because the
+ * test suite layers md devices on top of loopback devices.
+ * This may be removed when the loopback driver is fixed.
+ *
+ * BUG_ON(!lo || (rw != READ && rw != WRITE));
+ */
+#ifdef CONFIG_BUG
+ if ((MAJOR(bdev->bd_dev) == LOOP_MAJOR) ||
+ (MAJOR(bdev->bd_dev) == MD_MAJOR))
+ return;
+
+#ifdef BLOCK_EXT_MAJOR
+ if (MAJOR(bdev->bd_dev) == BLOCK_EXT_MAJOR)
+ return;
+#endif /* BLOCK_EXT_MAJOR */
+#endif /* CONFIG_BUG */
+ *flags |=
+ ((1 << BIO_RW_FAILFAST_DEV) |
+ (1 << BIO_RW_FAILFAST_TRANSPORT) |
+ (1 << BIO_RW_FAILFAST_DRIVER));
+#else /* !HAVE_BIO_RW_FAILFAST */
+ *flags |= (1 << BIO_RW_FAILFAST);
+#endif /* HAVE_BIO_RW_FAILFAST */
+}
+
#ifndef DISK_NAME_LEN
#define DISK_NAME_LEN 32
#endif /* DISK_NAME_LEN */
diff --git a/include/sys/fm/Makefile.in b/include/sys/fm/Makefile.in
index 0cfa33043..5e1f4b883 100644
--- a/include/sys/fm/Makefile.in
+++ b/include/sys/fm/Makefile.in
@@ -44,6 +44,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-bdev-logical-size.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
+ $(top_srcdir)/config/kernel-bio-failfast.m4 \
$(top_srcdir)/config/kernel-bio-rw-syncio.m4 \
$(top_srcdir)/config/kernel-blk-end-request.m4 \
$(top_srcdir)/config/kernel-blk-fetch-request.m4 \
diff --git a/include/sys/fm/fs/Makefile.in b/include/sys/fm/fs/Makefile.in
index 4a31d6580..ed828ebdd 100644
--- a/include/sys/fm/fs/Makefile.in
+++ b/include/sys/fm/fs/Makefile.in
@@ -44,6 +44,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-bdev-logical-size.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
+ $(top_srcdir)/config/kernel-bio-failfast.m4 \
$(top_srcdir)/config/kernel-bio-rw-syncio.m4 \
$(top_srcdir)/config/kernel-blk-end-request.m4 \
$(top_srcdir)/config/kernel-blk-fetch-request.m4 \
diff --git a/include/sys/fs/Makefile.in b/include/sys/fs/Makefile.in
index 25c170cc7..3103ffa67 100644
--- a/include/sys/fs/Makefile.in
+++ b/include/sys/fs/Makefile.in
@@ -44,6 +44,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-bdev-logical-size.m4 \
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
+ $(top_srcdir)/config/kernel-bio-failfast.m4 \
$(top_srcdir)/config/kernel-bio-rw-syncio.m4 \
$(top_srcdir)/config/kernel-blk-end-request.m4 \
$(top_srcdir)/config/kernel-blk-fetch-request.m4 \