mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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.
This commit is contained 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 \
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -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 \
|
||||
|
||||
Reference in New Issue
Block a user