Skip to content

Commit 5f37736

Browse files
ahrensChristopher Siden
authored andcommitted
5177 remove dead code from dsl_scan.c
Reviewed by: Christopher Siden <christopher.siden@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Richard Elling <richard.elling@gmail.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Robert Mustacchi <rm@joyent.com>
1 parent 42fcb65 commit 5f37736

File tree

1 file changed

+36
-44
lines changed

1 file changed

+36
-44
lines changed

usr/src/uts/common/fs/zfs/dsl_scan.c

Lines changed: 36 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,12 @@ dsl_scan_cancel(dsl_pool_t *dp)
351351
dsl_scan_cancel_sync, NULL, 3, ZFS_SPACE_CHECK_RESERVED));
352352
}
353353

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);
358357
static void dsl_scan_visitdnode(dsl_scan_t *, dsl_dataset_t *ds,
359358
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);
361360

362361
void
363362
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,
590589
static int
591590
dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
592591
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)
594593
{
595594
dsl_pool_t *dp = scn->scn_dp;
596595
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,
601600
int i;
602601
blkptr_t *cbp;
603602
int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT;
603+
arc_buf_t *buf;
604604

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,
606606
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
607607
if (err) {
608608
scn->scn_phys.scn_errors++;
609609
return (err);
610610
}
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,
613613
zb->zb_object, zb->zb_blkid * epb + i);
614614
}
615-
for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) {
615+
for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) {
616616
zbookmark_phys_t czb;
617617

618618
SET_BOOKMARK(&czb, zb->zb_objset, zb->zb_object,
619619
zb->zb_level - 1,
620620
zb->zb_blkid * epb + i);
621621
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);
632623
}
624+
(void) arc_buf_remove_ref(buf, &buf);
633625
} else if (BP_GET_TYPE(bp) == DMU_OT_DNODE) {
634626
uint32_t flags = ARC_WAIT;
635627
dnode_phys_t *cdnp;
636628
int i, j;
637629
int epb = BP_GET_LSIZE(bp) >> DNODE_SHIFT;
630+
arc_buf_t *buf;
638631

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,
640633
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
641634
if (err) {
642635
scn->scn_phys.scn_errors++;
643636
return (err);
644637
}
645-
for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) {
638+
for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) {
646639
for (j = 0; j < cdnp->dn_nblkptr; j++) {
647640
blkptr_t *cbp = &cdnp->dn_blkptr[j];
648-
dsl_scan_prefetch(scn, *bufp, cbp,
641+
dsl_scan_prefetch(scn, buf, cbp,
649642
zb->zb_objset, zb->zb_blkid * epb + i, j);
650643
}
651644
}
652-
for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) {
645+
for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) {
653646
dsl_scan_visitdnode(scn, ds, ostype,
654-
cdnp, *bufp, zb->zb_blkid * epb + i, tx);
647+
cdnp, zb->zb_blkid * epb + i, tx);
655648
}
656649

650+
(void) arc_buf_remove_ref(buf, &buf);
657651
} else if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) {
658652
uint32_t flags = ARC_WAIT;
659653
objset_phys_t *osp;
654+
arc_buf_t *buf;
660655

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,
662657
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
663658
if (err) {
664659
scn->scn_phys.scn_errors++;
665660
return (err);
666661
}
667662

668-
osp = (*bufp)->b_data;
663+
osp = buf->b_data;
669664

670665
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);
672667

673-
if (OBJSET_BUF_HAS_USERUSED(*bufp)) {
668+
if (OBJSET_BUF_HAS_USERUSED(buf)) {
674669
/*
675670
* We also always visit user/group accounting
676671
* objects, and never skip them, even if we are
677672
* pausing. This is necessary so that the space
678673
* deltas from this txg get integrated.
679674
*/
680675
dsl_scan_visitdnode(scn, ds, osp->os_type,
681-
&osp->os_groupused_dnode, *bufp,
676+
&osp->os_groupused_dnode,
682677
DMU_GROUPUSED_OBJECT, tx);
683678
dsl_scan_visitdnode(scn, ds, osp->os_type,
684-
&osp->os_userused_dnode, *bufp,
679+
&osp->os_userused_dnode,
685680
DMU_USERUSED_OBJECT, tx);
686681
}
682+
(void) arc_buf_remove_ref(buf, &buf);
687683
}
688684

689685
return (0);
690686
}
691687

692688
static void
693689
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,
695691
uint64_t object, dmu_tx_t *tx)
696692
{
697693
int j;
@@ -702,15 +698,15 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
702698
SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object,
703699
dnp->dn_nlevels - 1, j);
704700
dsl_scan_visitbp(&dnp->dn_blkptr[j],
705-
&czb, dnp, buf, ds, scn, ostype, tx);
701+
&czb, dnp, ds, scn, ostype, tx);
706702
}
707703

708704
if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) {
709705
zbookmark_phys_t czb;
710706
SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object,
711707
0, DMU_SPILL_BLKID);
712708
dsl_scan_visitbp(&dnp->dn_spill,
713-
&czb, dnp, buf, ds, scn, ostype, tx);
709+
&czb, dnp, ds, scn, ostype, tx);
714710
}
715711
}
716712

@@ -720,9 +716,8 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
720716
*/
721717
static void
722718
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)
726721
{
727722
dsl_pool_t *dp = scn->scn_dp;
728723
arc_buf_t *buf = NULL;
@@ -742,16 +737,15 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
742737
scn->scn_visited_this_txg++;
743738

744739
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",
746741
ds, ds ? ds->ds_object : 0,
747742
zb->zb_objset, zb->zb_object, zb->zb_level, zb->zb_blkid,
748-
pbuf, bp);
743+
bp);
749744

750745
if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg)
751746
return;
752747

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)
755749
return;
756750

757751
/*
@@ -775,8 +769,6 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
775769
if (BP_PHYSICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_max_txg) {
776770
scan_funcs[scn->scn_phys.scn_func](dp, bp, zb);
777771
}
778-
if (buf)
779-
(void) arc_buf_remove_ref(buf, &buf);
780772
}
781773

782774
static void
@@ -787,7 +779,7 @@ dsl_scan_visit_rootbp(dsl_scan_t *scn, dsl_dataset_t *ds, blkptr_t *bp,
787779

788780
SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET,
789781
ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID);
790-
dsl_scan_visitbp(bp, &zb, NULL, NULL,
782+
dsl_scan_visitbp(bp, &zb, NULL,
791783
ds, scn, DMU_OST_NONE, tx);
792784

793785
dprintf_ds(ds, "finished scan%s", "");

0 commit comments

Comments
 (0)