diff options
author | Matthew Macy <[email protected]> | 2020-02-26 16:09:17 -0800 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-26 16:09:17 -0800 |
commit | 28caa74b196553aaafda6d0a881668735d627d82 (patch) | |
tree | 45c69d5ef7d50efd5b45c11037946dd8225dedaf /module/zfs/vdev.c | |
parent | 647ff8e975d2087ade05d862eb19a589ab155126 (diff) |
Refactor dnode dirty context from dbuf_dirty
* Add dedicated donde_set_dirtyctx routine.
* Add empty dirty record on destroy assertion.
* Make much more extensive use of the SET_ERROR macro.
Reviewed-by: Will Andrews <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Matthew Ahrens <[email protected]>
Signed-off-by: Matt Macy <[email protected]>
Closes #9924
Diffstat (limited to 'module/zfs/vdev.c')
-rw-r--r-- | module/zfs/vdev.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index 7dc00650c..fb0d02eea 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -1702,7 +1702,7 @@ vdev_open(vdev_t *vd) */ vd->vdev_reopening = B_FALSE; if (zio_injection_enabled && error == 0) - error = zio_handle_device_injection(vd, NULL, ENXIO); + error = zio_handle_device_injection(vd, NULL, SET_ERROR(ENXIO)); if (error) { if (vd->vdev_removed && @@ -2306,7 +2306,7 @@ vdev_create(vdev_t *vd, uint64_t txg, boolean_t isreplacing) if (error || vd->vdev_state != VDEV_STATE_HEALTHY) { vdev_close(vd); - return (error ? error : ENXIO); + return (error ? error : SET_ERROR(ENXIO)); } /* @@ -2929,8 +2929,10 @@ vdev_dtl_required(vdev_t *vd) vd->vdev_cant_read = cant_read; vdev_dtl_reassess(tvd, 0, 0, B_FALSE); - if (!required && zio_injection_enabled) - required = !!zio_handle_device_injection(vd, NULL, ECHILD); + if (!required && zio_injection_enabled) { + required = !!zio_handle_device_injection(vd, NULL, + SET_ERROR(ECHILD)); + } return (required); } @@ -3333,10 +3335,10 @@ vdev_fault(spa_t *spa, uint64_t guid, vdev_aux_t aux) spa_vdev_state_enter(spa, SCL_NONE); if ((vd = spa_lookup_by_guid(spa, guid, B_TRUE)) == NULL) - return (spa_vdev_state_exit(spa, NULL, ENODEV)); + return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENODEV))); if (!vd->vdev_ops->vdev_op_leaf) - return (spa_vdev_state_exit(spa, NULL, ENOTSUP)); + return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENOTSUP))); tvd = vd->vdev_top; @@ -3415,10 +3417,10 @@ vdev_degrade(spa_t *spa, uint64_t guid, vdev_aux_t aux) spa_vdev_state_enter(spa, SCL_NONE); if ((vd = spa_lookup_by_guid(spa, guid, B_TRUE)) == NULL) - return (spa_vdev_state_exit(spa, NULL, ENODEV)); + return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENODEV))); if (!vd->vdev_ops->vdev_op_leaf) - return (spa_vdev_state_exit(spa, NULL, ENOTSUP)); + return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENOTSUP))); /* * If the vdev is already faulted, then don't do anything. @@ -3452,10 +3454,10 @@ vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, vdev_state_t *newstate) spa_vdev_state_enter(spa, SCL_NONE); if ((vd = spa_lookup_by_guid(spa, guid, B_TRUE)) == NULL) - return (spa_vdev_state_exit(spa, NULL, ENODEV)); + return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENODEV))); if (!vd->vdev_ops->vdev_op_leaf) - return (spa_vdev_state_exit(spa, NULL, ENOTSUP)); + return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENOTSUP))); wasoffline = (vd->vdev_offline || vd->vdev_tmpoffline); oldstate = vd->vdev_state; @@ -3537,10 +3539,10 @@ top: spa_vdev_state_enter(spa, SCL_ALLOC); if ((vd = spa_lookup_by_guid(spa, guid, B_TRUE)) == NULL) - return (spa_vdev_state_exit(spa, NULL, ENODEV)); + return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENODEV))); if (!vd->vdev_ops->vdev_op_leaf) - return (spa_vdev_state_exit(spa, NULL, ENOTSUP)); + return (spa_vdev_state_exit(spa, NULL, SET_ERROR(ENOTSUP))); tvd = vd->vdev_top; mg = tvd->vdev_mg; @@ -3557,7 +3559,8 @@ top: */ if (!tvd->vdev_islog && vd->vdev_aux == NULL && vdev_dtl_required(vd)) - return (spa_vdev_state_exit(spa, NULL, EBUSY)); + return (spa_vdev_state_exit(spa, NULL, + SET_ERROR(EBUSY))); /* * If the top-level is a slog and it has had allocations @@ -3614,7 +3617,8 @@ top: vdev_is_dead(tvd)) { vd->vdev_offline = B_FALSE; vdev_reopen(tvd); - return (spa_vdev_state_exit(spa, NULL, EBUSY)); + return (spa_vdev_state_exit(spa, NULL, + SET_ERROR(EBUSY))); } /* |