MFC r272584: MFV r272501:
Illumos issue: 5177 remove dead code from dsl_scan.c
This commit is contained in:
parent
5e5e0768f2
commit
6bc23f0b46
@ -384,13 +384,12 @@ dsl_scan_cancel(dsl_pool_t *dp)
|
|||||||
dsl_scan_cancel_sync, NULL, 3, ZFS_SPACE_CHECK_RESERVED));
|
dsl_scan_cancel_sync, NULL, 3, ZFS_SPACE_CHECK_RESERVED));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dsl_scan_visitbp(blkptr_t *bp,
|
static void dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
|
||||||
const zbookmark_phys_t *zb, dnode_phys_t *dnp, arc_buf_t *pbuf,
|
dnode_phys_t *dnp, dsl_dataset_t *ds, dsl_scan_t *scn,
|
||||||
dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype,
|
dmu_objset_type_t ostype, dmu_tx_t *tx);
|
||||||
dmu_tx_t *tx);
|
|
||||||
static void dsl_scan_visitdnode(dsl_scan_t *, dsl_dataset_t *ds,
|
static void dsl_scan_visitdnode(dsl_scan_t *, dsl_dataset_t *ds,
|
||||||
dmu_objset_type_t ostype,
|
dmu_objset_type_t ostype,
|
||||||
dnode_phys_t *dnp, arc_buf_t *buf, uint64_t object, dmu_tx_t *tx);
|
dnode_phys_t *dnp, uint64_t object, dmu_tx_t *tx);
|
||||||
|
|
||||||
void
|
void
|
||||||
dsl_free(dsl_pool_t *dp, uint64_t txg, const blkptr_t *bp)
|
dsl_free(dsl_pool_t *dp, uint64_t txg, const blkptr_t *bp)
|
||||||
@ -624,7 +623,7 @@ dsl_scan_check_resume(dsl_scan_t *scn, const dnode_phys_t *dnp,
|
|||||||
static int
|
static int
|
||||||
dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
|
dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
|
||||||
dnode_phys_t *dnp, const blkptr_t *bp,
|
dnode_phys_t *dnp, const blkptr_t *bp,
|
||||||
const zbookmark_phys_t *zb, dmu_tx_t *tx, arc_buf_t **bufp)
|
const zbookmark_phys_t *zb, dmu_tx_t *tx)
|
||||||
{
|
{
|
||||||
dsl_pool_t *dp = scn->scn_dp;
|
dsl_pool_t *dp = scn->scn_dp;
|
||||||
int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD;
|
int zio_flags = ZIO_FLAG_CANFAIL | ZIO_FLAG_SCAN_THREAD;
|
||||||
@ -635,76 +634,72 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
|
|||||||
int i;
|
int i;
|
||||||
blkptr_t *cbp;
|
blkptr_t *cbp;
|
||||||
int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT;
|
int epb = BP_GET_LSIZE(bp) >> SPA_BLKPTRSHIFT;
|
||||||
|
arc_buf_t *buf;
|
||||||
|
|
||||||
err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp,
|
err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf,
|
||||||
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
|
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
|
||||||
if (err) {
|
if (err) {
|
||||||
scn->scn_phys.scn_errors++;
|
scn->scn_phys.scn_errors++;
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) {
|
for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) {
|
||||||
dsl_scan_prefetch(scn, *bufp, cbp, zb->zb_objset,
|
dsl_scan_prefetch(scn, buf, cbp, zb->zb_objset,
|
||||||
zb->zb_object, zb->zb_blkid * epb + i);
|
zb->zb_object, zb->zb_blkid * epb + i);
|
||||||
}
|
}
|
||||||
for (i = 0, cbp = (*bufp)->b_data; i < epb; i++, cbp++) {
|
for (i = 0, cbp = buf->b_data; i < epb; i++, cbp++) {
|
||||||
zbookmark_phys_t czb;
|
zbookmark_phys_t czb;
|
||||||
|
|
||||||
SET_BOOKMARK(&czb, zb->zb_objset, zb->zb_object,
|
SET_BOOKMARK(&czb, zb->zb_objset, zb->zb_object,
|
||||||
zb->zb_level - 1,
|
zb->zb_level - 1,
|
||||||
zb->zb_blkid * epb + i);
|
zb->zb_blkid * epb + i);
|
||||||
dsl_scan_visitbp(cbp, &czb, dnp,
|
dsl_scan_visitbp(cbp, &czb, dnp,
|
||||||
*bufp, ds, scn, ostype, tx);
|
ds, scn, ostype, tx);
|
||||||
}
|
|
||||||
} else if (BP_GET_TYPE(bp) == DMU_OT_USERGROUP_USED) {
|
|
||||||
uint32_t flags = ARC_WAIT;
|
|
||||||
|
|
||||||
err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp,
|
|
||||||
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
|
|
||||||
if (err) {
|
|
||||||
scn->scn_phys.scn_errors++;
|
|
||||||
return (err);
|
|
||||||
}
|
}
|
||||||
|
(void) arc_buf_remove_ref(buf, &buf);
|
||||||
} else if (BP_GET_TYPE(bp) == DMU_OT_DNODE) {
|
} else if (BP_GET_TYPE(bp) == DMU_OT_DNODE) {
|
||||||
uint32_t flags = ARC_WAIT;
|
uint32_t flags = ARC_WAIT;
|
||||||
dnode_phys_t *cdnp;
|
dnode_phys_t *cdnp;
|
||||||
int i, j;
|
int i, j;
|
||||||
int epb = BP_GET_LSIZE(bp) >> DNODE_SHIFT;
|
int epb = BP_GET_LSIZE(bp) >> DNODE_SHIFT;
|
||||||
|
arc_buf_t *buf;
|
||||||
|
|
||||||
err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp,
|
err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf,
|
||||||
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
|
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
|
||||||
if (err) {
|
if (err) {
|
||||||
scn->scn_phys.scn_errors++;
|
scn->scn_phys.scn_errors++;
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) {
|
for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) {
|
||||||
for (j = 0; j < cdnp->dn_nblkptr; j++) {
|
for (j = 0; j < cdnp->dn_nblkptr; j++) {
|
||||||
blkptr_t *cbp = &cdnp->dn_blkptr[j];
|
blkptr_t *cbp = &cdnp->dn_blkptr[j];
|
||||||
dsl_scan_prefetch(scn, *bufp, cbp,
|
dsl_scan_prefetch(scn, buf, cbp,
|
||||||
zb->zb_objset, zb->zb_blkid * epb + i, j);
|
zb->zb_objset, zb->zb_blkid * epb + i, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0, cdnp = (*bufp)->b_data; i < epb; i++, cdnp++) {
|
for (i = 0, cdnp = buf->b_data; i < epb; i++, cdnp++) {
|
||||||
dsl_scan_visitdnode(scn, ds, ostype,
|
dsl_scan_visitdnode(scn, ds, ostype,
|
||||||
cdnp, *bufp, zb->zb_blkid * epb + i, tx);
|
cdnp, zb->zb_blkid * epb + i, tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void) arc_buf_remove_ref(buf, &buf);
|
||||||
} else if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) {
|
} else if (BP_GET_TYPE(bp) == DMU_OT_OBJSET) {
|
||||||
uint32_t flags = ARC_WAIT;
|
uint32_t flags = ARC_WAIT;
|
||||||
objset_phys_t *osp;
|
objset_phys_t *osp;
|
||||||
|
arc_buf_t *buf;
|
||||||
|
|
||||||
err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, bufp,
|
err = arc_read(NULL, dp->dp_spa, bp, arc_getbuf_func, &buf,
|
||||||
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
|
ZIO_PRIORITY_ASYNC_READ, zio_flags, &flags, zb);
|
||||||
if (err) {
|
if (err) {
|
||||||
scn->scn_phys.scn_errors++;
|
scn->scn_phys.scn_errors++;
|
||||||
return (err);
|
return (err);
|
||||||
}
|
}
|
||||||
|
|
||||||
osp = (*bufp)->b_data;
|
osp = buf->b_data;
|
||||||
|
|
||||||
dsl_scan_visitdnode(scn, ds, osp->os_type,
|
dsl_scan_visitdnode(scn, ds, osp->os_type,
|
||||||
&osp->os_meta_dnode, *bufp, DMU_META_DNODE_OBJECT, tx);
|
&osp->os_meta_dnode, DMU_META_DNODE_OBJECT, tx);
|
||||||
|
|
||||||
if (OBJSET_BUF_HAS_USERUSED(*bufp)) {
|
if (OBJSET_BUF_HAS_USERUSED(buf)) {
|
||||||
/*
|
/*
|
||||||
* We also always visit user/group accounting
|
* We also always visit user/group accounting
|
||||||
* objects, and never skip them, even if we are
|
* objects, and never skip them, even if we are
|
||||||
@ -712,12 +707,13 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
|
|||||||
* deltas from this txg get integrated.
|
* deltas from this txg get integrated.
|
||||||
*/
|
*/
|
||||||
dsl_scan_visitdnode(scn, ds, osp->os_type,
|
dsl_scan_visitdnode(scn, ds, osp->os_type,
|
||||||
&osp->os_groupused_dnode, *bufp,
|
&osp->os_groupused_dnode,
|
||||||
DMU_GROUPUSED_OBJECT, tx);
|
DMU_GROUPUSED_OBJECT, tx);
|
||||||
dsl_scan_visitdnode(scn, ds, osp->os_type,
|
dsl_scan_visitdnode(scn, ds, osp->os_type,
|
||||||
&osp->os_userused_dnode, *bufp,
|
&osp->os_userused_dnode,
|
||||||
DMU_USERUSED_OBJECT, tx);
|
DMU_USERUSED_OBJECT, tx);
|
||||||
}
|
}
|
||||||
|
(void) arc_buf_remove_ref(buf, &buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
@ -725,7 +721,7 @@ dsl_scan_recurse(dsl_scan_t *scn, dsl_dataset_t *ds, dmu_objset_type_t ostype,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
|
dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
|
||||||
dmu_objset_type_t ostype, dnode_phys_t *dnp, arc_buf_t *buf,
|
dmu_objset_type_t ostype, dnode_phys_t *dnp,
|
||||||
uint64_t object, dmu_tx_t *tx)
|
uint64_t object, dmu_tx_t *tx)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
@ -736,7 +732,7 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
|
|||||||
SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object,
|
SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object,
|
||||||
dnp->dn_nlevels - 1, j);
|
dnp->dn_nlevels - 1, j);
|
||||||
dsl_scan_visitbp(&dnp->dn_blkptr[j],
|
dsl_scan_visitbp(&dnp->dn_blkptr[j],
|
||||||
&czb, dnp, buf, ds, scn, ostype, tx);
|
&czb, dnp, ds, scn, ostype, tx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) {
|
if (dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) {
|
||||||
@ -744,7 +740,7 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
|
|||||||
SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object,
|
SET_BOOKMARK(&czb, ds ? ds->ds_object : 0, object,
|
||||||
0, DMU_SPILL_BLKID);
|
0, DMU_SPILL_BLKID);
|
||||||
dsl_scan_visitbp(&dnp->dn_spill,
|
dsl_scan_visitbp(&dnp->dn_spill,
|
||||||
&czb, dnp, buf, ds, scn, ostype, tx);
|
&czb, dnp, ds, scn, ostype, tx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -754,9 +750,8 @@ dsl_scan_visitdnode(dsl_scan_t *scn, dsl_dataset_t *ds,
|
|||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
|
dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
|
||||||
dnode_phys_t *dnp, arc_buf_t *pbuf,
|
dnode_phys_t *dnp, dsl_dataset_t *ds, dsl_scan_t *scn,
|
||||||
dsl_dataset_t *ds, dsl_scan_t *scn, dmu_objset_type_t ostype,
|
dmu_objset_type_t ostype, dmu_tx_t *tx)
|
||||||
dmu_tx_t *tx)
|
|
||||||
{
|
{
|
||||||
dsl_pool_t *dp = scn->scn_dp;
|
dsl_pool_t *dp = scn->scn_dp;
|
||||||
arc_buf_t *buf = NULL;
|
arc_buf_t *buf = NULL;
|
||||||
@ -776,16 +771,15 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
|
|||||||
scn->scn_visited_this_txg++;
|
scn->scn_visited_this_txg++;
|
||||||
|
|
||||||
dprintf_bp(bp,
|
dprintf_bp(bp,
|
||||||
"visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx buf=%p bp=%p",
|
"visiting ds=%p/%llu zb=%llx/%llx/%llx/%llx bp=%p",
|
||||||
ds, ds ? ds->ds_object : 0,
|
ds, ds ? ds->ds_object : 0,
|
||||||
zb->zb_objset, zb->zb_object, zb->zb_level, zb->zb_blkid,
|
zb->zb_objset, zb->zb_object, zb->zb_level, zb->zb_blkid,
|
||||||
pbuf, bp);
|
bp);
|
||||||
|
|
||||||
if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg)
|
if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (dsl_scan_recurse(scn, ds, ostype, dnp, &bp_toread, zb, tx,
|
if (dsl_scan_recurse(scn, ds, ostype, dnp, &bp_toread, zb, tx) != 0)
|
||||||
&buf) != 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -809,8 +803,6 @@ dsl_scan_visitbp(blkptr_t *bp, const zbookmark_phys_t *zb,
|
|||||||
if (BP_PHYSICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_max_txg) {
|
if (BP_PHYSICAL_BIRTH(bp) <= scn->scn_phys.scn_cur_max_txg) {
|
||||||
scan_funcs[scn->scn_phys.scn_func](dp, bp, zb);
|
scan_funcs[scn->scn_phys.scn_func](dp, bp, zb);
|
||||||
}
|
}
|
||||||
if (buf)
|
|
||||||
(void) arc_buf_remove_ref(buf, &buf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -821,7 +813,7 @@ dsl_scan_visit_rootbp(dsl_scan_t *scn, dsl_dataset_t *ds, blkptr_t *bp,
|
|||||||
|
|
||||||
SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET,
|
SET_BOOKMARK(&zb, ds ? ds->ds_object : DMU_META_OBJSET,
|
||||||
ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID);
|
ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID);
|
||||||
dsl_scan_visitbp(bp, &zb, NULL, NULL,
|
dsl_scan_visitbp(bp, &zb, NULL,
|
||||||
ds, scn, DMU_OST_NONE, tx);
|
ds, scn, DMU_OST_NONE, tx);
|
||||||
|
|
||||||
dprintf_ds(ds, "finished scan%s", "");
|
dprintf_ds(ds, "finished scan%s", "");
|
||||||
|
Loading…
Reference in New Issue
Block a user