@@ -389,13 +389,12 @@ dsl_scan_cancel(dsl_pool_t *dp)
389
389
dsl_scan_cancel_sync , NULL , 3 ));
390
390
}
391
391
392
- static void dsl_scan_visitbp (blkptr_t * bp ,
393
- const zbookmark_phys_t * zb , dnode_phys_t * dnp , arc_buf_t * pbuf ,
394
- dsl_dataset_t * ds , dsl_scan_t * scn , dmu_objset_type_t ostype ,
395
- dmu_tx_t * tx );
392
+ static void dsl_scan_visitbp (blkptr_t * bp , const zbookmark_phys_t * zb ,
393
+ dnode_phys_t * dnp , dsl_dataset_t * ds , dsl_scan_t * scn ,
394
+ dmu_objset_type_t ostype , dmu_tx_t * tx );
396
395
inline __attribute__((always_inline )) static void dsl_scan_visitdnode (
397
396
dsl_scan_t * , dsl_dataset_t * ds , dmu_objset_type_t ostype ,
398
- dnode_phys_t * dnp , arc_buf_t * buf , uint64_t object , dmu_tx_t * tx );
397
+ dnode_phys_t * dnp , uint64_t object , dmu_tx_t * tx );
399
398
400
399
void
401
400
dsl_free (dsl_pool_t * dp , uint64_t txg , const blkptr_t * bp )
@@ -628,7 +627,7 @@ dsl_scan_check_resume(dsl_scan_t *scn, const dnode_phys_t *dnp,
628
627
inline __attribute__((always_inline )) static int
629
628
dsl_scan_recurse (dsl_scan_t * scn , dsl_dataset_t * ds , dmu_objset_type_t ostype ,
630
629
dnode_phys_t * dnp , const blkptr_t * bp ,
631
- const zbookmark_phys_t * zb , dmu_tx_t * tx , arc_buf_t * * bufp )
630
+ const zbookmark_phys_t * zb , dmu_tx_t * tx )
632
631
{
633
632
dsl_pool_t * dp = scn -> scn_dp ;
634
633
int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD ;
@@ -639,97 +638,94 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
639
638
int i ;
640
639
blkptr_t * cbp ;
641
640
int epb = BP_GET_LSIZE (bp ) >> SPA_BLKPTRSHIFT ;
641
+ arc_buf_t * buf ;
642
642
643
- err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , bufp ,
643
+ err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , & buf ,
644
644
ZIO_PRIORITY_ASYNC_READ , zio_flags , & flags , zb );
645
645
if (err ) {
646
646
scn -> scn_phys .scn_errors ++ ;
647
647
return (err );
648
648
}
649
- for (i = 0 , cbp = ( * bufp ) -> b_data ; i < epb ; i ++ , cbp ++ ) {
650
- dsl_scan_prefetch (scn , * bufp , cbp , zb -> zb_objset ,
649
+ for (i = 0 , cbp = buf -> b_data ; i < epb ; i ++ , cbp ++ ) {
650
+ dsl_scan_prefetch (scn , buf , cbp , zb -> zb_objset ,
651
651
zb -> zb_object , zb -> zb_blkid * epb + i );
652
652
}
653
- for (i = 0 , cbp = ( * bufp ) -> b_data ; i < epb ; i ++ , cbp ++ ) {
653
+ for (i = 0 , cbp = buf -> b_data ; i < epb ; i ++ , cbp ++ ) {
654
654
zbookmark_phys_t czb ;
655
655
656
656
SET_BOOKMARK (& czb , zb -> zb_objset , zb -> zb_object ,
657
657
zb -> zb_level - 1 ,
658
658
zb -> zb_blkid * epb + i );
659
659
dsl_scan_visitbp (cbp , & czb , dnp ,
660
- * bufp , ds , scn , ostype , tx );
661
- }
662
- } else if (BP_GET_TYPE (bp ) == DMU_OT_USERGROUP_USED ) {
663
- uint32_t flags = ARC_WAIT ;
664
-
665
- err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , bufp ,
666
- ZIO_PRIORITY_ASYNC_READ , zio_flags , & flags , zb );
667
- if (err ) {
668
- scn -> scn_phys .scn_errors ++ ;
669
- return (err );
660
+ ds , scn , ostype , tx );
670
661
}
662
+ (void ) arc_buf_remove_ref (buf , & buf );
671
663
} else if (BP_GET_TYPE (bp ) == DMU_OT_DNODE ) {
672
664
uint32_t flags = ARC_WAIT ;
673
665
dnode_phys_t * cdnp ;
674
666
int i , j ;
675
667
int epb = BP_GET_LSIZE (bp ) >> DNODE_SHIFT ;
668
+ arc_buf_t * buf ;
676
669
677
- err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , bufp ,
670
+ err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , & buf ,
678
671
ZIO_PRIORITY_ASYNC_READ , zio_flags , & flags , zb );
679
672
if (err ) {
680
673
scn -> scn_phys .scn_errors ++ ;
681
674
return (err );
682
675
}
683
- for (i = 0 , cdnp = ( * bufp ) -> b_data ; i < epb ; i ++ , cdnp ++ ) {
676
+ for (i = 0 , cdnp = buf -> b_data ; i < epb ; i ++ , cdnp ++ ) {
684
677
for (j = 0 ; j < cdnp -> dn_nblkptr ; j ++ ) {
685
678
blkptr_t * cbp = & cdnp -> dn_blkptr [j ];
686
- dsl_scan_prefetch (scn , * bufp , cbp ,
679
+ dsl_scan_prefetch (scn , buf , cbp ,
687
680
zb -> zb_objset , zb -> zb_blkid * epb + i , j );
688
681
}
689
682
}
690
- for (i = 0 , cdnp = ( * bufp ) -> b_data ; i < epb ; i ++ , cdnp ++ ) {
683
+ for (i = 0 , cdnp = buf -> b_data ; i < epb ; i ++ , cdnp ++ ) {
691
684
dsl_scan_visitdnode (scn , ds , ostype ,
692
- cdnp , * bufp , zb -> zb_blkid * epb + i , tx );
685
+ cdnp , zb -> zb_blkid * epb + i , tx );
693
686
}
694
687
688
+ (void ) arc_buf_remove_ref (buf , & buf );
695
689
} else if (BP_GET_TYPE (bp ) == DMU_OT_OBJSET ) {
696
690
uint32_t flags = ARC_WAIT ;
697
691
objset_phys_t * osp ;
692
+ arc_buf_t * buf ;
698
693
699
- err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , bufp ,
694
+ err = arc_read (NULL , dp -> dp_spa , bp , arc_getbuf_func , & buf ,
700
695
ZIO_PRIORITY_ASYNC_READ , zio_flags , & flags , zb );
701
696
if (err ) {
702
697
scn -> scn_phys .scn_errors ++ ;
703
698
return (err );
704
699
}
705
700
706
- osp = ( * bufp ) -> b_data ;
701
+ osp = buf -> b_data ;
707
702
708
703
dsl_scan_visitdnode (scn , ds , osp -> os_type ,
709
- & osp -> os_meta_dnode , * bufp , DMU_META_DNODE_OBJECT , tx );
704
+ & osp -> os_meta_dnode , DMU_META_DNODE_OBJECT , tx );
710
705
711
- if (OBJSET_BUF_HAS_USERUSED (* bufp )) {
706
+ if (OBJSET_BUF_HAS_USERUSED (buf )) {
712
707
/*
713
708
* We also always visit user/group accounting
714
709
* objects, and never skip them, even if we are
715
710
* pausing. This is necessary so that the space
716
711
* deltas from this txg get integrated.
717
712
*/
718
713
dsl_scan_visitdnode (scn , ds , osp -> os_type ,
719
- & osp -> os_groupused_dnode , * bufp ,
714
+ & osp -> os_groupused_dnode ,
720
715
DMU_GROUPUSED_OBJECT , tx );
721
716
dsl_scan_visitdnode (scn , ds , osp -> os_type ,
722
- & osp -> os_userused_dnode , * bufp ,
717
+ & osp -> os_userused_dnode ,
723
718
DMU_USERUSED_OBJECT , tx );
724
719
}
720
+ (void ) arc_buf_remove_ref (buf , & buf );
725
721
}
726
722
727
723
return (0 );
728
724
}
729
725
730
726
inline __attribute__((always_inline )) static void
731
727
dsl_scan_visitdnode (dsl_scan_t * scn , dsl_dataset_t * ds ,
732
- dmu_objset_type_t ostype , dnode_phys_t * dnp , arc_buf_t * buf ,
728
+ dmu_objset_type_t ostype , dnode_phys_t * dnp ,
733
729
uint64_t object , dmu_tx_t * tx )
734
730
{
735
731
int j ;
@@ -740,15 +736,15 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
740
736
SET_BOOKMARK (& czb , ds ? ds -> ds_object : 0 , object ,
741
737
dnp -> dn_nlevels - 1 , j );
742
738
dsl_scan_visitbp (& dnp -> dn_blkptr [j ],
743
- & czb , dnp , buf , ds , scn , ostype , tx );
739
+ & czb , dnp , ds , scn , ostype , tx );
744
740
}
745
741
746
742
if (dnp -> dn_flags & DNODE_FLAG_SPILL_BLKPTR ) {
747
743
zbookmark_phys_t czb ;
748
744
SET_BOOKMARK (& czb , ds ? ds -> ds_object : 0 , object ,
749
745
0 , DMU_SPILL_BLKID );
750
746
dsl_scan_visitbp (& dnp -> dn_spill ,
751
- & czb , dnp , buf , ds , scn , ostype , tx );
747
+ & czb , dnp , ds , scn , ostype , tx );
752
748
}
753
749
}
754
750
@@ -758,12 +754,10 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
758
754
*/
759
755
static void
760
756
dsl_scan_visitbp (blkptr_t * bp , const zbookmark_phys_t * zb ,
761
- dnode_phys_t * dnp , arc_buf_t * pbuf ,
762
- dsl_dataset_t * ds , dsl_scan_t * scn , dmu_objset_type_t ostype ,
763
- dmu_tx_t * tx )
757
+ dnode_phys_t * dnp , dsl_dataset_t * ds , dsl_scan_t * scn ,
758
+ dmu_objset_type_t ostype , dmu_tx_t * tx )
764
759
{
765
760
dsl_pool_t * dp = scn -> scn_dp ;
766
- arc_buf_t * buf = NULL ;
767
761
blkptr_t * bp_toread ;
768
762
769
763
bp_toread = kmem_alloc (sizeof (blkptr_t ), KM_PUSHPAGE );
@@ -789,17 +783,16 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
789
783
* if required to debug an issue in dsl_scan_visitbp().
790
784
*
791
785
* dprintf_bp(bp,
792
- * "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx buf=%p bp=%p",
786
+ * "visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx bp=%p",
793
787
* ds, ds ? ds->ds_object : 0,
794
788
* zb->zb_objset, zb->zb_object, zb->zb_level, zb->zb_blkid,
795
- * pbuf, bp);
789
+ * bp);
796
790
*/
797
791
798
792
if (bp -> blk_birth <= scn -> scn_phys .scn_cur_min_txg )
799
793
goto out ;
800
794
801
- if (dsl_scan_recurse (scn , ds , ostype , dnp , bp_toread , zb , tx ,
802
- & buf ) != 0 )
795
+ if (dsl_scan_recurse (scn , ds , ostype , dnp , bp_toread , zb , tx ) != 0 )
803
796
goto out ;
804
797
805
798
/*
@@ -809,7 +802,6 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
809
802
*/
810
803
if (ddt_class_contains (dp -> dp_spa ,
811
804
scn -> scn_phys .scn_ddt_class_max , bp )) {
812
- ASSERT (buf == NULL );
813
805
goto out ;
814
806
}
815
807
@@ -823,8 +815,6 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
823
815
if (BP_PHYSICAL_BIRTH (bp ) <= scn -> scn_phys .scn_cur_max_txg ) {
824
816
scan_funcs [scn -> scn_phys .scn_func ](dp , bp , zb );
825
817
}
826
- if (buf )
827
- (void ) arc_buf_remove_ref (buf , & buf );
828
818
out :
829
819
kmem_free (bp_toread , sizeof (blkptr_t ));
830
820
}
@@ -837,7 +827,7 @@ dsl_scan_visit_rootbp(dsl_scan_t *scn, dsl_dataset_t *ds, blkptr_t *bp,
837
827
838
828
SET_BOOKMARK (& zb , ds ? ds -> ds_object : DMU_META_OBJSET ,
839
829
ZB_ROOT_OBJECT , ZB_ROOT_LEVEL , ZB_ROOT_BLKID );
840
- dsl_scan_visitbp (bp , & zb , NULL , NULL ,
830
+ dsl_scan_visitbp (bp , & zb , NULL ,
841
831
ds , scn , DMU_OST_NONE , tx );
842
832
843
833
dprintf_ds (ds , "finished scan%s" , "" );
0 commit comments