git://git.camperquake.de
/
zfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make commands load zfs module on demand
[zfs.git]
/
module
/
zfs
/
dsl_scan.c
diff --git
a/module/zfs/dsl_scan.c
b/module/zfs/dsl_scan.c
index
56d4108
..
c37a822
100644
(file)
--- a/
module/zfs/dsl_scan.c
+++ b/
module/zfs/dsl_scan.c
@@
-50,9
+50,7
@@
typedef int (scan_cb_t)(dsl_pool_t *, const blkptr_t *, const zbookmark_t *);
typedef int (scan_cb_t)(dsl_pool_t *, const blkptr_t *, const zbookmark_t *);
-static scan_cb_t dsl_scan_defrag_cb;
static scan_cb_t dsl_scan_scrub_cb;
static scan_cb_t dsl_scan_scrub_cb;
-static scan_cb_t dsl_scan_remove_cb;
static dsl_syncfunc_t dsl_scan_cancel_sync;
static void dsl_scan_sync_state(dsl_scan_t *, dmu_tx_t *tx);
static dsl_syncfunc_t dsl_scan_cancel_sync;
static void dsl_scan_sync_state(dsl_scan_t *, dmu_tx_t *tx);
@@
-194,9
+192,9
@@
dsl_scan_setup_sync(void *arg1, void *arg2, dmu_tx_t *tx)
if (vdev_resilver_needed(spa->spa_root_vdev,
&scn->scn_phys.scn_min_txg, &scn->scn_phys.scn_max_txg)) {
if (vdev_resilver_needed(spa->spa_root_vdev,
&scn->scn_phys.scn_min_txg, &scn->scn_phys.scn_max_txg)) {
- spa_event_notify(spa, NULL,
ESC
_ZFS_RESILVER_START);
+ spa_event_notify(spa, NULL,
FM_EREPORT
_ZFS_RESILVER_START);
} else {
} else {
- spa_event_notify(spa, NULL,
ESC
_ZFS_SCRUB_START);
+ spa_event_notify(spa, NULL,
FM_EREPORT
_ZFS_SCRUB_START);
}
spa->spa_scrub_started = B_TRUE;
}
spa->spa_scrub_started = B_TRUE;
@@
-297,7
+295,8
@@
dsl_scan_done(dsl_scan_t *scn, boolean_t complete, dmu_tx_t *tx)
complete ? scn->scn_phys.scn_max_txg : 0, B_TRUE);
if (complete) {
spa_event_notify(spa, NULL, scn->scn_phys.scn_min_txg ?
complete ? scn->scn_phys.scn_max_txg : 0, B_TRUE);
if (complete) {
spa_event_notify(spa, NULL, scn->scn_phys.scn_min_txg ?
- ESC_ZFS_RESILVER_FINISH : ESC_ZFS_SCRUB_FINISH);
+ FM_EREPORT_ZFS_RESILVER_FINISH :
+ FM_EREPORT_ZFS_SCRUB_FINISH);
}
spa_errlog_rotate(spa);
}
spa_errlog_rotate(spa);
@@
-792,18
+791,21
@@
dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb,
{
dsl_pool_t *dp = scn->scn_dp;
arc_buf_t *buf = NULL;
{
dsl_pool_t *dp = scn->scn_dp;
arc_buf_t *buf = NULL;
- blkptr_t bp_toread = *bp;
+ blkptr_t *bp_toread;
+
+ bp_toread = kmem_alloc(sizeof (blkptr_t), KM_SLEEP);
+ *bp_toread = *bp;
/* ASSERT(pbuf == NULL || arc_released(pbuf)); */
if (dsl_scan_check_pause(scn, zb))
/* ASSERT(pbuf == NULL || arc_released(pbuf)); */
if (dsl_scan_check_pause(scn, zb))
-
return
;
+
goto out
;
if (dsl_scan_check_resume(scn, dnp, zb))
if (dsl_scan_check_resume(scn, dnp, zb))
-
return
;
+
goto out
;
if (bp->blk_birth == 0)
if (bp->blk_birth == 0)
-
return
;
+
goto out
;
scn->scn_visited_this_txg++;
scn->scn_visited_this_txg++;
@@
-814,7
+816,7
@@
dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb,
pbuf, bp);
if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg)
pbuf, bp);
if (bp->blk_birth <= scn->scn_phys.scn_cur_min_txg)
-
return
;
+
goto out
;
if (BP_GET_TYPE(bp) != DMU_OT_USERGROUP_USED) {
/*
if (BP_GET_TYPE(bp) != DMU_OT_USERGROUP_USED) {
/*
@@
-829,12
+831,12
@@
dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb,
* it (original untranslated -> translations from
* deleted snap -> now).
*/
* it (original untranslated -> translations from
* deleted snap -> now).
*/
- bp_toread = *bp;
+
*
bp_toread = *bp;
}
}
- if (dsl_scan_recurse(scn, ds, ostype, dnp,
&
bp_toread, zb, tx,
+ if (dsl_scan_recurse(scn, ds, ostype, dnp, bp_toread, zb, tx,
&buf) != 0)
&buf) != 0)
-
return
;
+
goto out
;
/*
* If dsl_scan_ddt() has aready visited this block, it will have
/*
* If dsl_scan_ddt() has aready visited this block, it will have
@@
-844,7
+846,7
@@
dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb,
if (ddt_class_contains(dp->dp_spa,
scn->scn_phys.scn_ddt_class_max, bp)) {
ASSERT(buf == NULL);
if (ddt_class_contains(dp->dp_spa,
scn->scn_phys.scn_ddt_class_max, bp)) {
ASSERT(buf == NULL);
-
return
;
+
goto out
;
}
/*
}
/*
@@
-859,6
+861,8
@@
dsl_scan_visitbp(blkptr_t *bp, const zbookmark_t *zb,
}
if (buf)
(void) arc_buf_remove_ref(buf, &buf);
}
if (buf)
(void) arc_buf_remove_ref(buf, &buf);
+out:
+ kmem_free(bp_toread, sizeof(blkptr_t));
}
static void
}
static void
@@
-1076,6
+1080,7
@@
dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_tx_t *tx)
dsl_pool_t *dp = scn->scn_dp;
dsl_dataset_t *ds;
objset_t *os;
dsl_pool_t *dp = scn->scn_dp;
dsl_dataset_t *ds;
objset_t *os;
+ char *dsname;
VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, &ds));
@@
-1098,7
+1103,7
@@
dsl_scan_visitds(dsl_scan_t *scn, uint64_t dsobj, dmu_tx_t *tx)
dmu_buf_will_dirty(ds->ds_dbuf, tx);
dsl_scan_visit_rootbp(scn, ds, &ds->ds_phys->ds_bp, tx);
dmu_buf_will_dirty(ds->ds_dbuf, tx);
dsl_scan_visit_rootbp(scn, ds, &ds->ds_phys->ds_bp, tx);
-
char *
dsname = kmem_alloc(ZFS_MAXNAMELEN, KM_SLEEP);
+ dsname = kmem_alloc(ZFS_MAXNAMELEN, KM_SLEEP);
dsl_dataset_name(ds, dsname);
zfs_dbgmsg("scanned dataset %llu (%s) with min=%llu max=%llu; "
"pausing=%u",
dsl_dataset_name(ds, dsname);
zfs_dbgmsg("scanned dataset %llu (%s) with min=%llu max=%llu; "
"pausing=%u",
@@
-1250,10
+1255,12
@@
static void
dsl_scan_ddt(dsl_scan_t *scn, dmu_tx_t *tx)
{
ddt_bookmark_t *ddb = &scn->scn_phys.scn_ddt_bookmark;
dsl_scan_ddt(dsl_scan_t *scn, dmu_tx_t *tx)
{
ddt_bookmark_t *ddb = &scn->scn_phys.scn_ddt_bookmark;
- ddt_entry_t dde
= { 0 }
;
+ ddt_entry_t dde;
int error;
uint64_t n = 0;
int error;
uint64_t n = 0;
+ bzero(&dde, sizeof (ddt_entry_t));
+
while ((error = ddt_walk(scn->scn_dp->dp_spa, ddb, &dde)) == 0) {
ddt_t *ddt;
while ((error = ddt_walk(scn->scn_dp->dp_spa, ddb, &dde)) == 0) {
ddt_t *ddt;
@@
-1294,11
+1301,12
@@
dsl_scan_ddt_entry(dsl_scan_t *scn, enum zio_checksum checksum,
ddt_phys_t *ddp = dde->dde_phys;
blkptr_t bp;
zbookmark_t zb = { 0 };
ddt_phys_t *ddp = dde->dde_phys;
blkptr_t bp;
zbookmark_t zb = { 0 };
+ int p;
if (scn->scn_phys.scn_state != DSS_SCANNING)
return;
if (scn->scn_phys.scn_state != DSS_SCANNING)
return;
- for (
int
p = 0; p < DDT_PHYS_TYPES; p++, ddp++) {
+ for (p = 0; p < DDT_PHYS_TYPES; p++, ddp++) {
if (ddp->ddp_phys_birth == 0 ||
ddp->ddp_phys_birth > scn->scn_phys.scn_cur_max_txg)
continue;
if (ddp->ddp_phys_birth == 0 ||
ddp->ddp_phys_birth > scn->scn_phys.scn_cur_max_txg)
continue;
@@
-1658,10
+1666,11
@@
dsl_scan_scrub_cb(dsl_pool_t *dp,
size_t size = BP_GET_PSIZE(bp);
spa_t *spa = dp->dp_spa;
uint64_t phys_birth = BP_PHYSICAL_BIRTH(bp);
size_t size = BP_GET_PSIZE(bp);
spa_t *spa = dp->dp_spa;
uint64_t phys_birth = BP_PHYSICAL_BIRTH(bp);
- boolean_t needs_io;
+ boolean_t needs_io
= B_FALSE
;
int zio_flags = ZIO_FLAG_SCAN_THREAD | ZIO_FLAG_RAW | ZIO_FLAG_CANFAIL;
int zio_flags = ZIO_FLAG_SCAN_THREAD | ZIO_FLAG_RAW | ZIO_FLAG_CANFAIL;
- int zio_priority;
+ int zio_priority
= 0
;
int scan_delay = 0;
int scan_delay = 0;
+ int d;
if (phys_birth <= scn->scn_phys.scn_min_txg ||
phys_birth >= scn->scn_phys.scn_max_txg)
if (phys_birth <= scn->scn_phys.scn_min_txg ||
phys_birth >= scn->scn_phys.scn_max_txg)
@@
-1686,7
+1695,7
@@
dsl_scan_scrub_cb(dsl_pool_t *dp,
if (zb->zb_level == ZB_ZIL_LEVEL)
zio_flags |= ZIO_FLAG_SPECULATIVE;
if (zb->zb_level == ZB_ZIL_LEVEL)
zio_flags |= ZIO_FLAG_SPECULATIVE;
- for (
int
d = 0; d < BP_GET_NDVAS(bp); d++) {
+ for (d = 0; d < BP_GET_NDVAS(bp); d++) {
vdev_t *vd = vdev_lookup_top(spa,
DVA_GET_VDEV(&bp->blk_dva[d]));
vdev_t *vd = vdev_lookup_top(spa,
DVA_GET_VDEV(&bp->blk_dva[d]));