Skip to content

Commit ebcf493

Browse files
ahrensbehlendorf
authored andcommitted
Illumos 5177 - remove dead code from dsl_scan.c
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> References: https://www.illumos.org/issues/5177 illumos/illumos-gate@5f37736 Porting notes: The local variable 'buf' was removed from dsl_scan_visitbp(). This wasn't part of the original patch but it should have been. Ported by: Turbo Fredriksson <turbo@bayour.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2712
1 parent 64dbba3 commit ebcf493

File tree

1 file changed

+36
-46
lines changed

1 file changed

+36
-46
lines changed

module/zfs/dsl_scan.c

Lines changed: 36 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,12 @@ dsl_scan_cancel(dsl_pool_t *dp)
389389
dsl_scan_cancel_sync, NULL, 3));
390390
}
391391

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);
396395
inline __attribute__((always_inline)) static void dsl_scan_visitdnode(
397396
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);
399398

400399
void
401400
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,
628627
inline __attribute__((always_inline)) static int
629628
dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
630629
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)
632631
{
633632
dsl_pool_t *dp = scn->scn_dp;
634633
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,
639638
int i;
640639
blkptr_t *cbp;
641640
int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT;
641+
arc_buf_t *buf;
642642

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,
644644
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
645645
if (err) {
646646
scn->scn_phys.scn_errors++;
647647
return (err);
648648
}
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,
651651
zb->zb_object, zb->zb_blkid * epb + i);
652652
}
653-
for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) {
653+
for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) {
654654
zbookmark_phys_t czb;
655655

656656
SET_BOOKMARK(&czb, zb->zb_objset, zb->zb_object,
657657
zb->zb_level - 1,
658658
zb->zb_blkid * epb + i);
659659
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);
670661
}
662+
(void) arc_buf_remove_ref(buf, &buf);
671663
} else if (BP_GET_TYPE(bp) == DMU_OT_DNODE) {
672664
uint32_t flags = ARC_WAIT;
673665
dnode_phys_t *cdnp;
674666
int i, j;
675667
int epb = BP_GET_LSIZE(bp) >> DNODE_SHIFT;
668+
arc_buf_t *buf;
676669

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,
678671
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
679672
if (err) {
680673
scn->scn_phys.scn_errors++;
681674
return (err);
682675
}
683-
for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) {
676+
for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) {
684677
for (j = 0; j < cdnp->dn_nblkptr; j++) {
685678
blkptr_t *cbp = &cdnp->dn_blkptr[j];
686-
dsl_scan_prefetch(scn, *bufp, cbp,
679+
dsl_scan_prefetch(scn, buf, cbp,
687680
zb->zb_objset, zb->zb_blkid * epb + i, j);
688681
}
689682
}
690-
for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) {
683+
for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) {
691684
dsl_scan_visitdnode(scn, ds, ostype,
692-
cdnp, *bufp, zb->zb_blkid * epb + i, tx);
685+
cdnp, zb->zb_blkid * epb + i, tx);
693686
}
694687

688+
(void) arc_buf_remove_ref(buf, &buf);
695689
} else if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) {
696690
uint32_t flags = ARC_WAIT;
697691
objset_phys_t *osp;
692+
arc_buf_t *buf;
698693

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,
700695
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
701696
if (err) {
702697
scn->scn_phys.scn_errors++;
703698
return (err);
704699
}
705700

706-
osp = (*bufp)->b_data;
701+
osp = buf->b_data;
707702

708703
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);
710705

711-
if (OBJSET_BUF_HAS_USERUSED(*bufp)) {
706+
if (OBJSET_BUF_HAS_USERUSED(buf)) {
712707
/*
713708
* We also always visit user/group accounting
714709
* objects, and never skip them, even if we are
715710
* pausing. This is necessary so that the space
716711
* deltas from this txg get integrated.
717712
*/
718713
dsl_scan_visitdnode(scn, ds, osp->os_type,
719-
&osp->os_groupused_dnode, *bufp,
714+
&osp->os_groupused_dnode,
720715
DMU_GROUPUSED_OBJECT, tx);
721716
dsl_scan_visitdnode(scn, ds, osp->os_type,
722-
&osp->os_userused_dnode, *bufp,
717+
&osp->os_userused_dnode,
723718
DMU_USERUSED_OBJECT, tx);
724719
}
720+
(void) arc_buf_remove_ref(buf, &buf);
725721
}
726722

727723
return (0);
728724
}
729725

730726
inline __attribute__((always_inline)) static void
731727
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,
733729
uint64_t object, dmu_tx_t *tx)
734730
{
735731
int j;
@@ -740,15 +736,15 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
740736
SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object,
741737
dnp->dn_nlevels - 1, j);
742738
dsl_scan_visitbp(&dnp->dn_blkptr[j],
743-
&czb, dnp, buf, ds, scn, ostype, tx);
739+
&czb, dnp, ds, scn, ostype, tx);
744740
}
745741

746742
if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) {
747743
zbookmark_phys_t czb;
748744
SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object,
749745
0, DMU_SPILL_BLKID);
750746
dsl_scan_visitbp(&dnp->dn_spill,
751-
&czb, dnp, buf, ds, scn, ostype, tx);
747+
&czb, dnp, ds, scn, ostype, tx);
752748
}
753749
}
754750

@@ -758,12 +754,10 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
758754
*/
759755
static void
760756
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)
764759
{
765760
dsl_pool_t *dp = scn->scn_dp;
766-
arc_buf_t *buf = NULL;
767761
blkptr_t *bp_toread;
768762

769763
bp_toread = kmem_alloc(sizeof (blkptr_t), KM_PUSHPAGE);
@@ -789,17 +783,16 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
789783
* if required to debug an issue in dsl_scan_visitbp().
790784
*
791785
* 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",
793787
* ds, ds ? ds->ds_object : 0,
794788
* zb->zb_objset, zb->zb_object, zb->zb_level, zb->zb_blkid,
795-
* pbuf, bp);
789+
* bp);
796790
*/
797791

798792
if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg)
799793
goto out;
800794

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)
803796
goto out;
804797

805798
/*
@@ -809,7 +802,6 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
809802
*/
810803
if (ddt_class_contains(dp->dp_spa,
811804
scn->scn_phys.scn_ddt_class_max, bp)) {
812-
ASSERT(buf == NULL);
813805
goto out;
814806
}
815807

@@ -823,8 +815,6 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
823815
if (BP_PHYSICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_max_txg) {
824816
scan_funcs[scn->scn_phys.scn_func](dp, bp, zb);
825817
}
826-
if (buf)
827-
(void) arc_buf_remove_ref(buf, &buf);
828818
out:
829819
kmem_free(bp_toread, sizeof (blkptr_t));
830820
}
@@ -837,7 +827,7 @@ dsl_scan_visit_rootbp(dsl_scan_t *scn, dsl_dataset_t *ds, blkptr_t *bp,
837827

838828
SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET,
839829
ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID);
840-
dsl_scan_visitbp(bp, &zb, NULL, NULL,
830+
dsl_scan_visitbp(bp, &zb, NULL,
841831
ds, scn, DMU_OST_NONE, tx);
842832

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

0 commit comments

Comments
 (0)