aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/vdev.c
diff options
context:
space:
mode:
authorIsaac Huang <[email protected]>2017-05-12 18:28:03 -0600
committerBrian Behlendorf <[email protected]>2017-05-12 17:28:03 -0700
commit3d6da72d183dc655a7dc8fd59f57748fc5c1806c (patch)
treeca6da500e5b88a5beaf9d4ef265eeb5964ff1a36 /module/zfs/vdev.c
parent8c54ddd33af92e5defc587a10914493ca85ad60c (diff)
Skip spurious resilver IO on raidz vdev
On a raidz vdev, a block that does not span all child vdevs, excluding its skip sectors if any, may not be affected by a child vdev outage or failure. In such cases, the block does not need to be resilvered. However, current resilver algorithm simply resilvers all blocks on a degraded raidz vdev. Such spurious IO is not only wasteful, but also adds the risk of overwriting good data. This patch eliminates such spurious IOs. Reviewed-by: Gvozden Neskovic <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Signed-off-by: Isaac Huang <[email protected]> Closes #5316
Diffstat (limited to 'module/zfs/vdev.c')
-rw-r--r--module/zfs/vdev.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index a71e678bb..f44d338ef 100644
--- a/module/zfs/vdev.c
+++ b/module/zfs/vdev.c
@@ -1820,6 +1820,21 @@ vdev_dtl_empty(vdev_t *vd, vdev_dtl_type_t t)
}
/*
+ * Returns B_TRUE if vdev determines offset needs to be resilvered.
+ */
+boolean_t
+vdev_dtl_need_resilver(vdev_t *vd, uint64_t offset, size_t psize)
+{
+ ASSERT(vd != vd->vdev_spa->spa_root_vdev);
+
+ if (vd->vdev_ops->vdev_op_need_resilver == NULL ||
+ vd->vdev_ops->vdev_op_leaf)
+ return (B_TRUE);
+
+ return (vd->vdev_ops->vdev_op_need_resilver(vd, offset, psize));
+}
+
+/*
* Returns the lowest txg in the DTL range.
*/
static uint64_t