diff options
author | Chris Dunlop <[email protected]> | 2015-03-27 15:04:12 +1100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-03-27 14:52:45 -0700 |
commit | ee2f17aa2af3d8620470c3bbbe6f9dac9449d546 (patch) | |
tree | e68634d9f3e2f11713f716befe615801c26eb61b /module/zfs | |
parent | a4069eef2e403a3b2a307b23b7500e2adc6ecae5 (diff) |
Align code with Illumos
Align code in traverse_visitbp() with that in Illumos in preparation for
applying Illumos-5694.
No functional change: use a temporary variable pd to replace multiple
occurrences of td->td_pfd. This increases our stack use slightly more
then normal because the function is called recursively.
Signed-off-by: Chris Dunlop <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #3230
Diffstat (limited to 'module/zfs')
-rw-r--r-- | module/zfs/dmu_traverse.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/module/zfs/dmu_traverse.c b/module/zfs/dmu_traverse.c index b5c1ec758..a8481aee6 100644 --- a/module/zfs/dmu_traverse.c +++ b/module/zfs/dmu_traverse.c @@ -213,6 +213,7 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, { int err = 0; arc_buf_t *buf = NULL; + prefetch_data_t *pd = td->td_pfd; switch (resume_skip_check(td, dnp, zb)) { case RESUME_SKIP_ALL: @@ -249,16 +250,14 @@ traverse_visitbp(traverse_data_t *td, const dnode_phys_t *dnp, return (0); } - if (td->td_pfd != NULL && !td->td_pfd->pd_exited && - prefetch_needed(td->td_pfd, bp)) { - mutex_enter(&td->td_pfd->pd_mtx); - ASSERT(td->td_pfd->pd_blks_fetched >= 0); - while (td->td_pfd->pd_blks_fetched == 0 && - !td->td_pfd->pd_exited) - cv_wait(&td->td_pfd->pd_cv, &td->td_pfd->pd_mtx); - td->td_pfd->pd_blks_fetched--; - cv_broadcast(&td->td_pfd->pd_cv); - mutex_exit(&td->td_pfd->pd_mtx); + if (pd != NULL && !pd->pd_exited && prefetch_needed(pd, bp)) { + mutex_enter(&pd->pd_mtx); + ASSERT(pd->pd_blks_fetched >= 0); + while (pd->pd_blks_fetched == 0 && !pd->pd_exited) + cv_wait(&pd->pd_cv, &pd->pd_mtx); + pd->pd_blks_fetched--; + cv_broadcast(&pd->pd_cv); + mutex_exit(&pd->pd_mtx); } if (BP_IS_HOLE(bp)) { |