]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Align code with Illumos
authorChris Dunlop <chris@onthe.net.au>
Fri, 27 Mar 2015 04:04:12 +0000 (15:04 +1100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 27 Mar 2015 21:52:45 +0000 (14:52 -0700)
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 <chris@onthe.net.au>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #3230

module/zfs/dmu_traverse.c

index b5c1ec758f8b250e50d94c9641eb206aa502d449..a8481aee61ee419543086aea8a8cb2f1610e3576 100644 (file)
@@ -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)) {