@@ -351,13 +351,12 @@ dsl_scan_cancel(dsl_pool_t *dp)
351
351
dsl_scan_cancel_sync , NULL , 3 , ZFS_SPACE_CHECK_RESERVED ));
352
352
}
353
353
354
- static void dsl_scan_visitbp (blkptr_t * bp ,
355
- const zbookmark_phys_t * zb , dnode_phys_t * dnp , arc_buf_t * pbuf ,
356
- dsl_dataset_t * ds , dsl_scan_t * scn , dmu_objset_type_t ostype ,
357
- dmu_tx_t * tx );
354
+ static void dsl_scan_visitbp (blkptr_t * bp , const zbookmark_phys_t * zb ,
355
+ dnode_phys_t * dnp , dsl_dataset_t * ds , dsl_scan_t * scn ,
356
+ dmu_objset_type_t ostype , dmu_tx_t * tx );
358
357
static void dsl_scan_visitdnode (dsl_scan_t * , dsl_dataset_t * ds ,
359
358
dmu_objset_type_t ostype ,
360
- dnode_phys_t * dnp , arc_buf_t * buf , uint64_t object , dmu_tx_t * tx );
359
+ dnode_phys_t * dnp , uint64_t object , dmu_tx_t * tx );
361
360
362
361
void
363
362
dsl_free (dsl_pool_t * dp , uint64_t txg , const blkptr_t * bp )
@@ -590,7 +589,7 @@ dsl_scan_check_resume(dsl_scan_t *scn, const dnode_phys_t *dnp,
590
589
static int
591
590
dsl_scan_recurse (dsl_scan_t * scn , dsl_dataset_t * ds , dmu_objset_type_t ostype ,
592
591
dnode_phys_t * dnp , const blkptr_t * bp ,
593
- const zbookmark_phys_t * zb , dmu_tx_t * tx , arc_buf_t * * bufp )
592
+ const zbookmark_phys_t * zb , dmu_tx_t * tx )
594
593
{
595
594
dsl_pool_t * dp = scn -> scn_dp ;
596
595
int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD ;
@@ -601,97 +600,94 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
601
600
int i ;
602
601
blkptr_t * cbp ;
603
602
int epb = BP_GET_LSIZE (bp ) >> SPA_BLKPTRSHIFT ;
603
+ arc_buf_t * buf ;
604
604
605
- err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , bufp ,
605
+ err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , & buf ,
606
606
ZIO_PRIORITY_ASYNC_READ , zio_flags , & flags , zb );
607
607
if (err ) {
608
608
scn -> scn_phys .scn_errors ++ ;
609
609
return (err );
610
610
}
611
- for (i = 0 , cbp = ( * bufp ) -> b_data ; i < epb ; i ++ , cbp ++ ) {
612
- dsl_scan_prefetch (scn , * bufp , cbp , zb -> zb_objset ,
611
+ for (i = 0 , cbp = buf -> b_data ; i < epb ; i ++ , cbp ++ ) {
612
+ dsl_scan_prefetch (scn , buf , cbp , zb -> zb_objset ,
613
613
zb -> zb_object , zb -> zb_blkid * epb + i );
614
614
}
615
- for (i = 0 , cbp = ( * bufp ) -> b_data ; i < epb ; i ++ , cbp ++ ) {
615
+ for (i = 0 , cbp = buf -> b_data ; i < epb ; i ++ , cbp ++ ) {
616
616
zbookmark_phys_t czb ;
617
617
618
618
SET_BOOKMARK (& czb , zb -> zb_objset , zb -> zb_object ,
619
619
zb -> zb_level - 1 ,
620
620
zb -> zb_blkid * epb + i );
621
621
dsl_scan_visitbp (cbp , & czb , dnp ,
622
- * bufp , ds , scn , ostype , tx );
623
- }
624
- } else if (BP_GET_TYPE (bp ) == DMU_OT_USERGROUP_USED ) {
625
- uint32_t flags = ARC_WAIT ;
626
-
627
- err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , bufp ,
628
- ZIO_PRIORITY_ASYNC_READ , zio_flags , & flags , zb );
629
- if (err ) {
630
- scn -> scn_phys .scn_errors ++ ;
631
- return (err );
622
+ ds , scn , ostype , tx );
632
623
}
624
+ (void ) arc_buf_remove_ref (buf , & buf );
633
625
} else if (BP_GET_TYPE (bp ) == DMU_OT_DNODE ) {
634
626
uint32_t flags = ARC_WAIT ;
635
627
dnode_phys_t * cdnp ;
636
628
int i , j ;
637
629
int epb = BP_GET_LSIZE (bp ) >> DNODE_SHIFT ;
630
+ arc_buf_t * buf ;
638
631
639
- err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , bufp ,
632
+ err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , & buf ,
640
633
ZIO_PRIORITY_ASYNC_READ , zio_flags , & flags , zb );
641
634
if (err ) {
642
635
scn -> scn_phys .scn_errors ++ ;
643
636
return (err );
644
637
}
645
- for (i = 0 , cdnp = ( * bufp ) -> b_data ; i < epb ; i ++ , cdnp ++ ) {
638
+ for (i = 0 , cdnp = buf -> b_data ; i < epb ; i ++ , cdnp ++ ) {
646
639
for (j = 0 ; j < cdnp -> dn_nblkptr ; j ++ ) {
647
640
blkptr_t * cbp = & cdnp -> dn_blkptr [j ];
648
- dsl_scan_prefetch (scn , * bufp , cbp ,
641
+ dsl_scan_prefetch (scn , buf , cbp ,
649
642
zb -> zb_objset , zb -> zb_blkid * epb + i , j );
650
643
}
651
644
}
652
- for (i = 0 , cdnp = ( * bufp ) -> b_data ; i < epb ; i ++ , cdnp ++ ) {
645
+ for (i = 0 , cdnp = buf -> b_data ; i < epb ; i ++ , cdnp ++ ) {
653
646
dsl_scan_visitdnode (scn , ds , ostype ,
654
- cdnp , * bufp , zb -> zb_blkid * epb + i , tx );
647
+ cdnp , zb -> zb_blkid * epb + i , tx );
655
648
}
656
649
650
+ (void ) arc_buf_remove_ref (buf , & buf );
657
651
} else if (BP_GET_TYPE (bp ) == DMU_OT_OBJSET ) {
658
652
uint32_t flags = ARC_WAIT ;
659
653
objset_phys_t * osp ;
654
+ arc_buf_t * buf ;
660
655
661
- err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , bufp ,
656
+ err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , & buf ,
662
657
ZIO_PRIORITY_ASYNC_READ , zio_flags , & flags , zb );
663
658
if (err ) {
664
659
scn -> scn_phys .scn_errors ++ ;
665
660
return (err );
666
661
}
667
662
668
- osp = ( * bufp ) -> b_data ;
663
+ osp = buf -> b_data ;
669
664
670
665
dsl_scan_visitdnode (scn , ds , osp -> os_type ,
671
- & osp -> os_meta_dnode , * bufp , DMU_META_DNODE_OBJECT , tx );
666
+ & osp -> os_meta_dnode , DMU_META_DNODE_OBJECT , tx );
672
667
673
- if (OBJSET_BUF_HAS_USERUSED (* bufp )) {
668
+ if (OBJSET_BUF_HAS_USERUSED (buf )) {
674
669
/*
675
670
* We also always visit user/group accounting
676
671
* objects, and never skip them, even if we are
677
672
* pausing. This is necessary so that the space
678
673
* deltas from this txg get integrated.
679
674
*/
680
675
dsl_scan_visitdnode (scn , ds , osp -> os_type ,
681
- & osp -> os_groupused_dnode , * bufp ,
676
+ & osp -> os_groupused_dnode ,
682
677
DMU_GROUPUSED_OBJECT , tx );
683
678
dsl_scan_visitdnode (scn , ds , osp -> os_type ,
684
- & osp -> os_userused_dnode , * bufp ,
679
+ & osp -> os_userused_dnode ,
685
680
DMU_USERUSED_OBJECT , tx );
686
681
}
682
+ (void ) arc_buf_remove_ref (buf , & buf );
687
683
}
688
684
689
685
return (0 );
690
686
}
691
687
692
688
static void
693
689
dsl_scan_visitdnode (dsl_scan_t * scn , dsl_dataset_t * ds ,
694
- dmu_objset_type_t ostype , dnode_phys_t * dnp , arc_buf_t * buf ,
690
+ dmu_objset_type_t ostype , dnode_phys_t * dnp ,
695
691
uint64_t object , dmu_tx_t * tx )
696
692
{
697
693
int j ;
@@ -702,15 +698,15 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
702
698
SET_BOOKMARK (& czb , ds ? ds -> ds_object : 0 , object ,
703
699
dnp -> dn_nlevels - 1 , j );
704
700
dsl_scan_visitbp (& dnp -> dn_blkptr [j ],
705
- & czb , dnp , buf , ds , scn , ostype , tx );
701
+ & czb , dnp , ds , scn , ostype , tx );
706
702
}
707
703
708
704
if (dnp -> dn_flags & DNODE_FLAG_SPILL_BLKPTR ) {
709
705
zbookmark_phys_t czb ;
710
706
SET_BOOKMARK (& czb , ds ? ds -> ds_object : 0 , object ,
711
707
0 , DMU_SPILL_BLKID );
712
708
dsl_scan_visitbp (& dnp -> dn_spill ,
713
- & czb , dnp , buf , ds , scn , ostype , tx );
709
+ & czb , dnp , ds , scn , ostype , tx );
714
710
}
715
711
}
716
712
@@ -720,9 +716,8 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
720
716
*/
721
717
static void
722
718
dsl_scan_visitbp (blkptr_t * bp , const zbookmark_phys_t * zb ,
723
- dnode_phys_t * dnp , arc_buf_t * pbuf ,
724
- dsl_dataset_t * ds , dsl_scan_t * scn , dmu_objset_type_t ostype ,
725
- dmu_tx_t * tx )
719
+ dnode_phys_t * dnp , dsl_dataset_t * ds , dsl_scan_t * scn ,
720
+ dmu_objset_type_t ostype , dmu_tx_t * tx )
726
721
{
727
722
dsl_pool_t * dp = scn -> scn_dp ;
728
723
arc_buf_t * buf = NULL ;
@@ -742,16 +737,15 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
742
737
scn -> scn_visited_this_txg ++ ;
743
738
744
739
dprintf_bp (bp ,
745
- "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx buf=%p bp=%p" ,
740
+ "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx bp=%p" ,
746
741
ds , ds ? ds -> ds_object : 0 ,
747
742
zb -> zb_objset , zb -> zb_object , zb -> zb_level , zb -> zb_blkid ,
748
- pbuf , bp );
743
+ bp );
749
744
750
745
if (bp -> blk_birth <= scn -> scn_phys .scn_cur_min_txg )
751
746
return ;
752
747
753
- if (dsl_scan_recurse (scn , ds , ostype , dnp , & bp_toread , zb , tx ,
754
- & buf ) != 0 )
748
+ if (dsl_scan_recurse (scn , ds , ostype , dnp , & bp_toread , zb , tx ) != 0 )
755
749
return ;
756
750
757
751
/*
@@ -775,8 +769,6 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
775
769
if (BP_PHYSICAL_BIRTH (bp ) <= scn -> scn_phys .scn_cur_max_txg ) {
776
770
scan_funcs [scn -> scn_phys .scn_func ](dp , bp , zb );
777
771
}
778
- if (buf )
779
- (void ) arc_buf_remove_ref (buf , & buf );
780
772
}
781
773
782
774
static void
@@ -787,7 +779,7 @@ dsl_scan_visit_rootbp(dsl_scan_t *scn, dsl_dataset_t *ds, blkptr_t *bp,
787
779
788
780
SET_BOOKMARK (& zb , ds ? ds -> ds_object : DMU_META_OBJSET ,
789
781
ZB_ROOT_OBJECT , ZB_ROOT_LEVEL , ZB_ROOT_BLKID );
790
- dsl_scan_visitbp (bp , & zb , NULL , NULL ,
782
+ dsl_scan_visitbp (bp , & zb , NULL ,
791
783
ds , scn , DMU_OST_NONE , tx );
792
784
793
785
dprintf_ds (ds , "finished scan%s" , "" );
0 commit comments