Merge commit 'refs/top-bases/linux-zfs-branch' into linux-zfs-branch

This commit is contained in:
Brian Behlendorf 2008-12-19 11:07:25 -08:00
commit 88ea519f3c
10 changed files with 84 additions and 53 deletions

View File

@ -1389,10 +1389,11 @@ static void
zdb_leak_init(spa_t *spa) zdb_leak_init(spa_t *spa)
{ {
vdev_t *rvd = spa->spa_root_vdev; vdev_t *rvd = spa->spa_root_vdev;
int c, m;
for (int c = 0; c < rvd->vdev_children; c++) { for (c = 0; c < rvd->vdev_children; c++) {
vdev_t *vd = rvd->vdev_child[c]; vdev_t *vd = rvd->vdev_child[c];
for (int m = 0; m < vd->vdev_ms_count; m++) { for (m = 0; m < vd->vdev_ms_count; m++) {
metaslab_t *msp = vd->vdev_ms[m]; metaslab_t *msp = vd->vdev_ms[m];
mutex_enter(&msp->ms_lock); mutex_enter(&msp->ms_lock);
VERIFY(space_map_load(&msp->ms_map, &zdb_space_map_ops, VERIFY(space_map_load(&msp->ms_map, &zdb_space_map_ops,
@ -1407,10 +1408,11 @@ static void
zdb_leak_fini(spa_t *spa) zdb_leak_fini(spa_t *spa)
{ {
vdev_t *rvd = spa->spa_root_vdev; vdev_t *rvd = spa->spa_root_vdev;
int c, m;
for (int c = 0; c < rvd->vdev_children; c++) { for (c = 0; c < rvd->vdev_children; c++) {
vdev_t *vd = rvd->vdev_child[c]; vdev_t *vd = rvd->vdev_child[c];
for (int m = 0; m < vd->vdev_ms_count; m++) { for (m = 0; m < vd->vdev_ms_count; m++) {
metaslab_t *msp = vd->vdev_ms[m]; metaslab_t *msp = vd->vdev_ms[m];
mutex_enter(&msp->ms_lock); mutex_enter(&msp->ms_lock);
space_map_unload(&msp->ms_map); space_map_unload(&msp->ms_map);
@ -1445,7 +1447,9 @@ typedef struct zdb_cb {
static void static void
zdb_count_block(spa_t *spa, zdb_cb_t *zcb, blkptr_t *bp, dmu_object_type_t type) zdb_count_block(spa_t *spa, zdb_cb_t *zcb, blkptr_t *bp, dmu_object_type_t type)
{ {
for (int i = 0; i < 4; i++) { int i;
for (i = 0; i < 4; i++) {
int l = (i < 2) ? BP_GET_LEVEL(bp) : ZB_TOTAL; int l = (i < 2) ? BP_GET_LEVEL(bp) : ZB_TOTAL;
int t = (i & 1) ? type : DMU_OT_TOTAL; int t = (i & 1) ? type : DMU_OT_TOTAL;
zdb_blkstats_t *zb = &zcb->zcb_type[l][t]; zdb_blkstats_t *zb = &zcb->zcb_type[l][t];

View File

@ -834,11 +834,12 @@ static vdev_t *
vdev_lookup_by_path(vdev_t *vd, const char *path) vdev_lookup_by_path(vdev_t *vd, const char *path)
{ {
vdev_t *mvd; vdev_t *mvd;
int c;
if (vd->vdev_path != NULL && strcmp(path, vd->vdev_path) == 0) if (vd->vdev_path != NULL && strcmp(path, vd->vdev_path) == 0)
return (vd); return (vd);
for (int c = 0; c < vd->vdev_children; c++) for (c = 0; c < vd->vdev_children; c++)
if ((mvd = vdev_lookup_by_path(vd->vdev_child[c], path)) != if ((mvd = vdev_lookup_by_path(vd->vdev_child[c], path)) !=
NULL) NULL)
return (mvd); return (mvd);

View File

@ -963,7 +963,7 @@ metaslab_alloc(spa_t *spa, metaslab_class_t *mc, uint64_t psize, blkptr_t *bp,
{ {
dva_t *dva = bp->blk_dva; dva_t *dva = bp->blk_dva;
dva_t *hintdva = hintbp->blk_dva; dva_t *hintdva = hintbp->blk_dva;
int error = 0; int d, error = 0;
ASSERT(bp->blk_birth == 0); ASSERT(bp->blk_birth == 0);
@ -978,7 +978,7 @@ metaslab_alloc(spa_t *spa, metaslab_class_t *mc, uint64_t psize, blkptr_t *bp,
ASSERT(BP_GET_NDVAS(bp) == 0); ASSERT(BP_GET_NDVAS(bp) == 0);
ASSERT(hintbp == NULL || ndvas <= BP_GET_NDVAS(hintbp)); ASSERT(hintbp == NULL || ndvas <= BP_GET_NDVAS(hintbp));
for (int d = 0; d < ndvas; d++) { for (d = 0; d < ndvas; d++) {
error = metaslab_alloc_dva(spa, mc, psize, dva, d, hintdva, error = metaslab_alloc_dva(spa, mc, psize, dva, d, hintdva,
txg, flags); txg, flags);
if (error) { if (error) {
@ -1004,14 +1004,14 @@ void
metaslab_free(spa_t *spa, const blkptr_t *bp, uint64_t txg, boolean_t now) metaslab_free(spa_t *spa, const blkptr_t *bp, uint64_t txg, boolean_t now)
{ {
const dva_t *dva = bp->blk_dva; const dva_t *dva = bp->blk_dva;
int ndvas = BP_GET_NDVAS(bp); int d, ndvas = BP_GET_NDVAS(bp);
ASSERT(!BP_IS_HOLE(bp)); ASSERT(!BP_IS_HOLE(bp));
ASSERT(!now || bp->blk_birth >= spa->spa_syncing_txg); ASSERT(!now || bp->blk_birth >= spa->spa_syncing_txg);
spa_config_enter(spa, SCL_FREE, FTAG, RW_READER); spa_config_enter(spa, SCL_FREE, FTAG, RW_READER);
for (int d = 0; d < ndvas; d++) for (d = 0; d < ndvas; d++)
metaslab_free_dva(spa, &dva[d], txg, now); metaslab_free_dva(spa, &dva[d], txg, now);
spa_config_exit(spa, SCL_FREE, FTAG); spa_config_exit(spa, SCL_FREE, FTAG);
@ -1022,7 +1022,7 @@ metaslab_claim(spa_t *spa, const blkptr_t *bp, uint64_t txg)
{ {
const dva_t *dva = bp->blk_dva; const dva_t *dva = bp->blk_dva;
int ndvas = BP_GET_NDVAS(bp); int ndvas = BP_GET_NDVAS(bp);
int error = 0; int d, error = 0;
ASSERT(!BP_IS_HOLE(bp)); ASSERT(!BP_IS_HOLE(bp));
@ -1037,7 +1037,7 @@ metaslab_claim(spa_t *spa, const blkptr_t *bp, uint64_t txg)
spa_config_enter(spa, SCL_ALLOC, FTAG, RW_READER); spa_config_enter(spa, SCL_ALLOC, FTAG, RW_READER);
for (int d = 0; d < ndvas; d++) for (d = 0; d < ndvas; d++)
if ((error = metaslab_claim_dva(spa, &dva[d], txg)) != 0) if ((error = metaslab_claim_dva(spa, &dva[d], txg)) != 0)
break; break;

View File

@ -260,7 +260,9 @@ int zfs_recover = 0;
static void static void
spa_config_lock_init(spa_t *spa) spa_config_lock_init(spa_t *spa)
{ {
for (int i = 0; i < SCL_LOCKS; i++) { int i;
for (i = 0; i < SCL_LOCKS; i++) {
spa_config_lock_t *scl = &spa->spa_config_lock[i]; spa_config_lock_t *scl = &spa->spa_config_lock[i];
mutex_init(&scl->scl_lock, NULL, MUTEX_DEFAULT, NULL); mutex_init(&scl->scl_lock, NULL, MUTEX_DEFAULT, NULL);
cv_init(&scl->scl_cv, NULL, CV_DEFAULT, NULL); cv_init(&scl->scl_cv, NULL, CV_DEFAULT, NULL);
@ -273,7 +275,9 @@ spa_config_lock_init(spa_t *spa)
static void static void
spa_config_lock_destroy(spa_t *spa) spa_config_lock_destroy(spa_t *spa)
{ {
for (int i = 0; i < SCL_LOCKS; i++) { int i;
for (i = 0; i < SCL_LOCKS; i++) {
spa_config_lock_t *scl = &spa->spa_config_lock[i]; spa_config_lock_t *scl = &spa->spa_config_lock[i];
mutex_destroy(&scl->scl_lock); mutex_destroy(&scl->scl_lock);
cv_destroy(&scl->scl_cv); cv_destroy(&scl->scl_cv);
@ -286,7 +290,9 @@ spa_config_lock_destroy(spa_t *spa)
int int
spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw) spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw)
{ {
for (int i = 0; i < SCL_LOCKS; i++) { int i;
for (i = 0; i < SCL_LOCKS; i++) {
spa_config_lock_t *scl = &spa->spa_config_lock[i]; spa_config_lock_t *scl = &spa->spa_config_lock[i];
if (!(locks & (1 << i))) if (!(locks & (1 << i)))
continue; continue;
@ -315,7 +321,9 @@ spa_config_tryenter(spa_t *spa, int locks, void *tag, krw_t rw)
void void
spa_config_enter(spa_t *spa, int locks, void *tag, krw_t rw) spa_config_enter(spa_t *spa, int locks, void *tag, krw_t rw)
{ {
for (int i = 0; i < SCL_LOCKS; i++) { int i;
for (i = 0; i < SCL_LOCKS; i++) {
spa_config_lock_t *scl = &spa->spa_config_lock[i]; spa_config_lock_t *scl = &spa->spa_config_lock[i];
if (!(locks & (1 << i))) if (!(locks & (1 << i)))
continue; continue;
@ -341,7 +349,9 @@ spa_config_enter(spa_t *spa, int locks, void *tag, krw_t rw)
void void
spa_config_exit(spa_t *spa, int locks, void *tag) spa_config_exit(spa_t *spa, int locks, void *tag)
{ {
for (int i = SCL_LOCKS - 1; i >= 0; i--) { int i;
for (i = SCL_LOCKS - 1; i >= 0; i--) {
spa_config_lock_t *scl = &spa->spa_config_lock[i]; spa_config_lock_t *scl = &spa->spa_config_lock[i];
if (!(locks & (1 << i))) if (!(locks & (1 << i)))
continue; continue;
@ -360,9 +370,9 @@ spa_config_exit(spa_t *spa, int locks, void *tag)
int int
spa_config_held(spa_t *spa, int locks, krw_t rw) spa_config_held(spa_t *spa, int locks, krw_t rw)
{ {
int locks_held = 0; int i, locks_held = 0;
for (int i = 0; i < SCL_LOCKS; i++) { for (i = 0; i < SCL_LOCKS; i++) {
spa_config_lock_t *scl = &spa->spa_config_lock[i]; spa_config_lock_t *scl = &spa->spa_config_lock[i];
if (!(locks & (1 << i))) if (!(locks & (1 << i)))
continue; continue;

View File

@ -866,6 +866,7 @@ vdev_probe(vdev_t *vd, zio_t *pio)
spa_t *spa = vd->vdev_spa; spa_t *spa = vd->vdev_spa;
vdev_probe_stats_t *vps; vdev_probe_stats_t *vps;
zio_t *zio; zio_t *zio;
int l;
vps = kmem_zalloc(sizeof (*vps), KM_SLEEP); vps = kmem_zalloc(sizeof (*vps), KM_SLEEP);
@ -898,7 +899,7 @@ vdev_probe(vdev_t *vd, zio_t *pio)
vps->vps_root = zio; vps->vps_root = zio;
vps->vps_vd = vd; vps->vps_vd = vd;
for (int l = 1; l < VDEV_LABELS; l++) { for (l = 1; l < VDEV_LABELS; l++) {
zio_nowait(zio_read_phys(zio, vd, zio_nowait(zio_read_phys(zio, vd,
vdev_label_offset(vd->vdev_psize, l, vdev_label_offset(vd->vdev_psize, l,
offsetof(vdev_label_t, vl_pad)), offsetof(vdev_label_t, vl_pad)),
@ -1792,6 +1793,7 @@ void
vdev_clear(spa_t *spa, vdev_t *vd) vdev_clear(spa_t *spa, vdev_t *vd)
{ {
vdev_t *rvd = spa->spa_root_vdev; vdev_t *rvd = spa->spa_root_vdev;
int c;
ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL); ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
@ -1802,7 +1804,7 @@ vdev_clear(spa_t *spa, vdev_t *vd)
vd->vdev_stat.vs_write_errors = 0; vd->vdev_stat.vs_write_errors = 0;
vd->vdev_stat.vs_checksum_errors = 0; vd->vdev_stat.vs_checksum_errors = 0;
for (int c = 0; c < vd->vdev_children; c++) for (c = 0; c < vd->vdev_children; c++)
vdev_clear(spa, vd->vdev_child[c]); vdev_clear(spa, vd->vdev_child[c]);
/* /*
@ -1885,6 +1887,7 @@ void
vdev_get_stats(vdev_t *vd, vdev_stat_t *vs) vdev_get_stats(vdev_t *vd, vdev_stat_t *vs)
{ {
vdev_t *rvd = vd->vdev_spa->spa_root_vdev; vdev_t *rvd = vd->vdev_spa->spa_root_vdev;
int c, t;
mutex_enter(&vd->vdev_stat_lock); mutex_enter(&vd->vdev_stat_lock);
bcopy(&vd->vdev_stat, vs, sizeof (*vs)); bcopy(&vd->vdev_stat, vs, sizeof (*vs));
@ -1899,12 +1902,12 @@ vdev_get_stats(vdev_t *vd, vdev_stat_t *vs)
* over all top-level vdevs (i.e. the direct children of the root). * over all top-level vdevs (i.e. the direct children of the root).
*/ */
if (vd == rvd) { if (vd == rvd) {
for (int c = 0; c < rvd->vdev_children; c++) { for (c = 0; c < rvd->vdev_children; c++) {
vdev_t *cvd = rvd->vdev_child[c]; vdev_t *cvd = rvd->vdev_child[c];
vdev_stat_t *cvs = &cvd->vdev_stat; vdev_stat_t *cvs = &cvd->vdev_stat;
mutex_enter(&vd->vdev_stat_lock); mutex_enter(&vd->vdev_stat_lock);
for (int t = 0; t < ZIO_TYPES; t++) { for (t = 0; t < ZIO_TYPES; t++) {
vs->vs_ops[t] += cvs->vs_ops[t]; vs->vs_ops[t] += cvs->vs_ops[t];
vs->vs_bytes[t] += cvs->vs_bytes[t]; vs->vs_bytes[t] += cvs->vs_bytes[t];
} }

View File

@ -335,7 +335,7 @@ vdev_label_read_config(vdev_t *vd)
nvlist_t *config = NULL; nvlist_t *config = NULL;
vdev_phys_t *vp; vdev_phys_t *vp;
zio_t *zio; zio_t *zio;
int flags = int l, flags =
ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE; ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE;
ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL); ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
@ -345,7 +345,7 @@ vdev_label_read_config(vdev_t *vd)
vp = zio_buf_alloc(sizeof (vdev_phys_t)); vp = zio_buf_alloc(sizeof (vdev_phys_t));
for (int l = 0; l < VDEV_LABELS; l++) { for (l = 0; l < VDEV_LABELS; l++) {
zio = zio_root(spa, NULL, NULL, flags); zio = zio_root(spa, NULL, NULL, flags);
@ -498,10 +498,11 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason)
int error; int error;
uint64_t spare_guid, l2cache_guid; uint64_t spare_guid, l2cache_guid;
int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL; int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL;
int c, l, n;
ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL); ASSERT(spa_config_held(spa, SCL_ALL, RW_WRITER) == SCL_ALL);
for (int c = 0; c < vd->vdev_children; c++) for (c = 0; c < vd->vdev_children; c++)
if ((error = vdev_label_init(vd->vdev_child[c], if ((error = vdev_label_init(vd->vdev_child[c],
crtxg, reason)) != 0) crtxg, reason)) != 0)
return (error); return (error);
@ -661,7 +662,7 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason)
*/ */
zio = zio_root(spa, NULL, NULL, flags); zio = zio_root(spa, NULL, NULL, flags);
for (int l = 0; l < VDEV_LABELS; l++) { for (l = 0; l < VDEV_LABELS; l++) {
vdev_label_write(zio, vd, l, vp, vdev_label_write(zio, vd, l, vp,
offsetof(vdev_label_t, vl_vdev_phys), offsetof(vdev_label_t, vl_vdev_phys),
@ -671,7 +672,7 @@ vdev_label_init(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason)
offsetof(vdev_label_t, vl_boot_header), offsetof(vdev_label_t, vl_boot_header),
sizeof (vdev_boot_header_t), NULL, NULL, flags); sizeof (vdev_boot_header_t), NULL, NULL, flags);
for (int n = 0; n < VDEV_UBERBLOCK_COUNT(vd); n++) { for (n = 0; n < VDEV_UBERBLOCK_COUNT(vd); n++) {
vdev_label_write(zio, vd, l, ub, vdev_label_write(zio, vd, l, ub,
VDEV_UBERBLOCK_OFFSET(vd, n), VDEV_UBERBLOCK_OFFSET(vd, n),
VDEV_UBERBLOCK_SIZE(vd), NULL, NULL, flags); VDEV_UBERBLOCK_SIZE(vd), NULL, NULL, flags);
@ -762,6 +763,7 @@ vdev_uberblock_load(zio_t *zio, vdev_t *vd, uberblock_t *ubbest)
vdev_t *rvd = spa->spa_root_vdev; vdev_t *rvd = spa->spa_root_vdev;
int flags = int flags =
ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE; ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE;
int c, l, n;
if (vd == rvd) { if (vd == rvd) {
ASSERT(zio == NULL); ASSERT(zio == NULL);
@ -772,12 +774,12 @@ vdev_uberblock_load(zio_t *zio, vdev_t *vd, uberblock_t *ubbest)
ASSERT(zio != NULL); ASSERT(zio != NULL);
for (int c = 0; c < vd->vdev_children; c++) for (c = 0; c < vd->vdev_children; c++)
vdev_uberblock_load(zio, vd->vdev_child[c], ubbest); vdev_uberblock_load(zio, vd->vdev_child[c], ubbest);
if (vd->vdev_ops->vdev_op_leaf && vdev_readable(vd)) { if (vd->vdev_ops->vdev_op_leaf && vdev_readable(vd)) {
for (int l = 0; l < VDEV_LABELS; l++) { for (l = 0; l < VDEV_LABELS; l++) {
for (int n = 0; n < VDEV_UBERBLOCK_COUNT(vd); n++) { for (n = 0; n < VDEV_UBERBLOCK_COUNT(vd); n++) {
vdev_label_read(zio, vd, l, vdev_label_read(zio, vd, l,
zio_buf_alloc(VDEV_UBERBLOCK_SIZE(vd)), zio_buf_alloc(VDEV_UBERBLOCK_SIZE(vd)),
VDEV_UBERBLOCK_OFFSET(vd, n), VDEV_UBERBLOCK_OFFSET(vd, n),
@ -813,9 +815,9 @@ static void
vdev_uberblock_sync(zio_t *zio, uberblock_t *ub, vdev_t *vd, int flags) vdev_uberblock_sync(zio_t *zio, uberblock_t *ub, vdev_t *vd, int flags)
{ {
uberblock_t *ubbuf; uberblock_t *ubbuf;
int n; int c, l, n;
for (int c = 0; c < vd->vdev_children; c++) for (c = 0; c < vd->vdev_children; c++)
vdev_uberblock_sync(zio, ub, vd->vdev_child[c], flags); vdev_uberblock_sync(zio, ub, vd->vdev_child[c], flags);
if (!vd->vdev_ops->vdev_op_leaf) if (!vd->vdev_ops->vdev_op_leaf)
@ -830,7 +832,7 @@ vdev_uberblock_sync(zio_t *zio, uberblock_t *ub, vdev_t *vd, int flags)
bzero(ubbuf, VDEV_UBERBLOCK_SIZE(vd)); bzero(ubbuf, VDEV_UBERBLOCK_SIZE(vd));
*ubbuf = *ub; *ubbuf = *ub;
for (int l = 0; l < VDEV_LABELS; l++) for (l = 0; l < VDEV_LABELS; l++)
vdev_label_write(zio, vd, l, ubbuf, vdev_label_write(zio, vd, l, ubbuf,
VDEV_UBERBLOCK_OFFSET(vd, n), VDEV_UBERBLOCK_SIZE(vd), VDEV_UBERBLOCK_OFFSET(vd, n), VDEV_UBERBLOCK_SIZE(vd),
vdev_uberblock_sync_done, zio->io_private, vdev_uberblock_sync_done, zio->io_private,
@ -845,10 +847,11 @@ vdev_uberblock_sync_list(vdev_t **svd, int svdcount, uberblock_t *ub, int flags)
spa_t *spa = svd[0]->vdev_spa; spa_t *spa = svd[0]->vdev_spa;
zio_t *zio; zio_t *zio;
uint64_t good_writes = 0; uint64_t good_writes = 0;
int v;
zio = zio_root(spa, NULL, &good_writes, flags); zio = zio_root(spa, NULL, &good_writes, flags);
for (int v = 0; v < svdcount; v++) for (v = 0; v < svdcount; v++)
vdev_uberblock_sync(zio, ub, svd[v], flags); vdev_uberblock_sync(zio, ub, svd[v], flags);
(void) zio_wait(zio); (void) zio_wait(zio);
@ -860,7 +863,7 @@ vdev_uberblock_sync_list(vdev_t **svd, int svdcount, uberblock_t *ub, int flags)
*/ */
zio = zio_root(spa, NULL, NULL, flags); zio = zio_root(spa, NULL, NULL, flags);
for (int v = 0; v < svdcount; v++) for (v = 0; v < svdcount; v++)
zio_flush(zio, svd[v]); zio_flush(zio, svd[v]);
(void) zio_wait(zio); (void) zio_wait(zio);
@ -913,8 +916,9 @@ vdev_label_sync(zio_t *zio, vdev_t *vd, int l, uint64_t txg, int flags)
vdev_phys_t *vp; vdev_phys_t *vp;
char *buf; char *buf;
size_t buflen; size_t buflen;
int c;
for (int c = 0; c < vd->vdev_children; c++) for (c = 0; c < vd->vdev_children; c++)
vdev_label_sync(zio, vd->vdev_child[c], l, txg, flags); vdev_label_sync(zio, vd->vdev_child[c], l, txg, flags);
if (!vd->vdev_ops->vdev_op_leaf) if (!vd->vdev_ops->vdev_op_leaf)

View File

@ -313,9 +313,9 @@ vdev_mirror_io_start(zio_t *zio)
static int static int
vdev_mirror_worst_error(mirror_map_t *mm) vdev_mirror_worst_error(mirror_map_t *mm)
{ {
int error[2] = { 0, 0 }; int c, error[2] = { 0, 0 };
for (int c = 0; c < mm->mm_children; c++) { for (c = 0; c < mm->mm_children; c++) {
mirror_child_t *mc = &mm->mm_child[c]; mirror_child_t *mc = &mm->mm_child[c];
int s = mc->mc_speculative; int s = mc->mc_speculative;
error[s] = zio_worst_error(error[s], mc->mc_error); error[s] = zio_worst_error(error[s], mc->mc_error);

View File

@ -285,12 +285,13 @@ void
vdev_queue_io_done(zio_t *zio) vdev_queue_io_done(zio_t *zio)
{ {
vdev_queue_t *vq = &zio->io_vd->vdev_queue; vdev_queue_t *vq = &zio->io_vd->vdev_queue;
int i;
mutex_enter(&vq->vq_lock); mutex_enter(&vq->vq_lock);
avl_remove(&vq->vq_pending_tree, zio); avl_remove(&vq->vq_pending_tree, zio);
for (int i = 0; i < zfs_vdev_ramp_rate; i++) { for (i = 0; i < zfs_vdev_ramp_rate; i++) {
zio_t *nio = vdev_queue_io_to_issue(vq, zfs_vdev_max_pending); zio_t *nio = vdev_queue_io_to_issue(vq, zfs_vdev_max_pending);
if (nio == NULL) if (nio == NULL)
break; break;

View File

@ -775,9 +775,9 @@ static uint64_t raidz_corrected_pq;
static int static int
vdev_raidz_worst_error(raidz_map_t *rm) vdev_raidz_worst_error(raidz_map_t *rm)
{ {
int error = 0; int c, error = 0;
for (int c = 0; c < rm->rm_cols; c++) for (c = 0; c < rm->rm_cols; c++)
error = zio_worst_error(error, rm->rm_col[c].rc_error); error = zio_worst_error(error, rm->rm_col[c].rc_error);
return (error); return (error);

View File

@ -1047,13 +1047,14 @@ static void
zio_reexecute(zio_t *pio) zio_reexecute(zio_t *pio)
{ {
zio_t *zio, *zio_next; zio_t *zio, *zio_next;
int c;
pio->io_flags = pio->io_orig_flags; pio->io_flags = pio->io_orig_flags;
pio->io_stage = pio->io_orig_stage; pio->io_stage = pio->io_orig_stage;
pio->io_pipeline = pio->io_orig_pipeline; pio->io_pipeline = pio->io_orig_pipeline;
pio->io_reexecute = 0; pio->io_reexecute = 0;
pio->io_error = 0; pio->io_error = 0;
for (int c = 0; c < ZIO_CHILD_TYPES; c++) for (c = 0; c < ZIO_CHILD_TYPES; c++)
pio->io_child_error[c] = 0; pio->io_child_error[c] = 0;
if (IO_IS_ALLOCATING(pio)) { if (IO_IS_ALLOCATING(pio)) {
@ -1311,8 +1312,9 @@ static void
zio_gang_node_free(zio_gang_node_t **gnpp) zio_gang_node_free(zio_gang_node_t **gnpp)
{ {
zio_gang_node_t *gn = *gnpp; zio_gang_node_t *gn = *gnpp;
int g;
for (int g = 0; g < SPA_GBH_NBLKPTRS; g++) for (g = 0; g < SPA_GBH_NBLKPTRS; g++)
ASSERT(gn->gn_child[g] == NULL); ASSERT(gn->gn_child[g] == NULL);
zio_buf_free(gn->gn_gbh, SPA_GANGBLOCKSIZE); zio_buf_free(gn->gn_gbh, SPA_GANGBLOCKSIZE);
@ -1324,11 +1326,12 @@ static void
zio_gang_tree_free(zio_gang_node_t **gnpp) zio_gang_tree_free(zio_gang_node_t **gnpp)
{ {
zio_gang_node_t *gn = *gnpp; zio_gang_node_t *gn = *gnpp;
int g;
if (gn == NULL) if (gn == NULL)
return; return;
for (int g = 0; g < SPA_GBH_NBLKPTRS; g++) for (g = 0; g < SPA_GBH_NBLKPTRS; g++)
zio_gang_tree_free(&gn->gn_child[g]); zio_gang_tree_free(&gn->gn_child[g]);
zio_gang_node_free(gnpp); zio_gang_node_free(gnpp);
@ -1353,6 +1356,7 @@ zio_gang_tree_assemble_done(zio_t *zio)
zio_t *lio = zio->io_logical; zio_t *lio = zio->io_logical;
zio_gang_node_t *gn = zio->io_private; zio_gang_node_t *gn = zio->io_private;
blkptr_t *bp = zio->io_bp; blkptr_t *bp = zio->io_bp;
int g;
ASSERT(zio->io_parent == lio); ASSERT(zio->io_parent == lio);
ASSERT(zio->io_child == NULL); ASSERT(zio->io_child == NULL);
@ -1367,7 +1371,7 @@ zio_gang_tree_assemble_done(zio_t *zio)
ASSERT(zio->io_size == SPA_GANGBLOCKSIZE); ASSERT(zio->io_size == SPA_GANGBLOCKSIZE);
ASSERT(gn->gn_gbh->zg_tail.zbt_magic == ZBT_MAGIC); ASSERT(gn->gn_gbh->zg_tail.zbt_magic == ZBT_MAGIC);
for (int g = 0; g < SPA_GBH_NBLKPTRS; g++) { for (g = 0; g < SPA_GBH_NBLKPTRS; g++) {
blkptr_t *gbp = &gn->gn_gbh->zg_blkptr[g]; blkptr_t *gbp = &gn->gn_gbh->zg_blkptr[g];
if (!BP_IS_GANG(gbp)) if (!BP_IS_GANG(gbp))
continue; continue;
@ -1380,6 +1384,7 @@ zio_gang_tree_issue(zio_t *pio, zio_gang_node_t *gn, blkptr_t *bp, void *data)
{ {
zio_t *lio = pio->io_logical; zio_t *lio = pio->io_logical;
zio_t *zio; zio_t *zio;
int g;
ASSERT(BP_IS_GANG(bp) == !!gn); ASSERT(BP_IS_GANG(bp) == !!gn);
ASSERT(BP_GET_CHECKSUM(bp) == BP_GET_CHECKSUM(lio->io_bp)); ASSERT(BP_GET_CHECKSUM(bp) == BP_GET_CHECKSUM(lio->io_bp));
@ -1394,7 +1399,7 @@ zio_gang_tree_issue(zio_t *pio, zio_gang_node_t *gn, blkptr_t *bp, void *data)
if (gn != NULL) { if (gn != NULL) {
ASSERT(gn->gn_gbh->zg_tail.zbt_magic == ZBT_MAGIC); ASSERT(gn->gn_gbh->zg_tail.zbt_magic == ZBT_MAGIC);
for (int g = 0; g < SPA_GBH_NBLKPTRS; g++) { for (g = 0; g < SPA_GBH_NBLKPTRS; g++) {
blkptr_t *gbp = &gn->gn_gbh->zg_blkptr[g]; blkptr_t *gbp = &gn->gn_gbh->zg_blkptr[g];
if (BP_IS_HOLE(gbp)) if (BP_IS_HOLE(gbp))
continue; continue;
@ -1451,6 +1456,7 @@ zio_write_gang_member_ready(zio_t *zio)
dva_t *cdva = zio->io_bp->blk_dva; dva_t *cdva = zio->io_bp->blk_dva;
dva_t *pdva = pio->io_bp->blk_dva; dva_t *pdva = pio->io_bp->blk_dva;
uint64_t asize; uint64_t asize;
int d;
if (BP_IS_HOLE(zio->io_bp)) if (BP_IS_HOLE(zio->io_bp))
return; return;
@ -1464,7 +1470,7 @@ zio_write_gang_member_ready(zio_t *zio)
ASSERT3U(BP_GET_NDVAS(zio->io_bp), <=, BP_GET_NDVAS(pio->io_bp)); ASSERT3U(BP_GET_NDVAS(zio->io_bp), <=, BP_GET_NDVAS(pio->io_bp));
mutex_enter(&pio->io_lock); mutex_enter(&pio->io_lock);
for (int d = 0; d < BP_GET_NDVAS(zio->io_bp); d++) { for (d = 0; d < BP_GET_NDVAS(zio->io_bp); d++) {
ASSERT(DVA_GET_GANG(&pdva[d])); ASSERT(DVA_GET_GANG(&pdva[d]));
asize = DVA_GET_ASIZE(&pdva[d]); asize = DVA_GET_ASIZE(&pdva[d]);
asize += DVA_GET_ASIZE(&cdva[d]); asize += DVA_GET_ASIZE(&cdva[d]);
@ -1488,7 +1494,7 @@ zio_write_gang_block(zio_t *pio)
int ndvas = lio->io_prop.zp_ndvas; int ndvas = lio->io_prop.zp_ndvas;
int gbh_ndvas = MIN(ndvas + 1, spa_max_replication(spa)); int gbh_ndvas = MIN(ndvas + 1, spa_max_replication(spa));
zio_prop_t zp; zio_prop_t zp;
int error; int g, error;
error = metaslab_alloc(spa, spa->spa_normal_class, SPA_GANGBLOCKSIZE, error = metaslab_alloc(spa, spa->spa_normal_class, SPA_GANGBLOCKSIZE,
bp, gbh_ndvas, txg, pio == lio ? NULL : lio->io_bp, bp, gbh_ndvas, txg, pio == lio ? NULL : lio->io_bp,
@ -1518,7 +1524,7 @@ zio_write_gang_block(zio_t *pio)
/* /*
* Create and nowait the gang children. * Create and nowait the gang children.
*/ */
for (int g = 0; resid != 0; resid -= lsize, g++) { for (g = 0; resid != 0; resid -= lsize, g++) {
lsize = P2ROUNDUP(resid / (SPA_GBH_NBLKPTRS - g), lsize = P2ROUNDUP(resid / (SPA_GBH_NBLKPTRS - g),
SPA_MINBLOCKSIZE); SPA_MINBLOCKSIZE);
ASSERT(lsize >= SPA_MINBLOCKSIZE && lsize <= resid); ASSERT(lsize >= SPA_MINBLOCKSIZE && lsize <= resid);
@ -1608,6 +1614,7 @@ zio_dva_unallocate(zio_t *zio, zio_gang_node_t *gn, blkptr_t *bp)
{ {
spa_t *spa = zio->io_spa; spa_t *spa = zio->io_spa;
boolean_t now = !(zio->io_flags & ZIO_FLAG_IO_REWRITE); boolean_t now = !(zio->io_flags & ZIO_FLAG_IO_REWRITE);
int g;
ASSERT(bp->blk_birth == zio->io_txg || BP_IS_HOLE(bp)); ASSERT(bp->blk_birth == zio->io_txg || BP_IS_HOLE(bp));
@ -1638,7 +1645,7 @@ zio_dva_unallocate(zio_t *zio, zio_gang_node_t *gn, blkptr_t *bp)
metaslab_free(spa, bp, bp->blk_birth, now); metaslab_free(spa, bp, bp->blk_birth, now);
if (gn != NULL) { if (gn != NULL) {
for (int g = 0; g < SPA_GBH_NBLKPTRS; g++) { for (g = 0; g < SPA_GBH_NBLKPTRS; g++) {
zio_dva_unallocate(zio, gn->gn_child[g], zio_dva_unallocate(zio, gn->gn_child[g],
&gn->gn_gbh->zg_blkptr[g]); &gn->gn_gbh->zg_blkptr[g]);
} }
@ -2082,6 +2089,7 @@ zio_done(zio_t *zio)
blkptr_t *bp = zio->io_bp; blkptr_t *bp = zio->io_bp;
vdev_t *vd = zio->io_vd; vdev_t *vd = zio->io_vd;
uint64_t psize = zio->io_size; uint64_t psize = zio->io_size;
int c, w;
/* /*
* If our of children haven't all completed, * If our of children haven't all completed,
@ -2092,8 +2100,8 @@ zio_done(zio_t *zio)
zio_wait_for_children(zio, ZIO_CHILD_LOGICAL, ZIO_WAIT_DONE)) zio_wait_for_children(zio, ZIO_CHILD_LOGICAL, ZIO_WAIT_DONE))
return (ZIO_PIPELINE_STOP); return (ZIO_PIPELINE_STOP);
for (int c = 0; c < ZIO_CHILD_TYPES; c++) for (c = 0; c < ZIO_CHILD_TYPES; c++)
for (int w = 0; w < ZIO_WAIT_TYPES; w++) for (w = 0; w < ZIO_WAIT_TYPES; w++)
ASSERT(zio->io_children[c][w] == 0); ASSERT(zio->io_children[c][w] == 0);
if (bp != NULL) { if (bp != NULL) {