summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-07-18 20:41:40 +0000
committerdelphij <delphij@FreeBSD.org>2014-07-18 20:41:40 +0000
commit9db99dff71d01cbbaa246dc65ca4ebd4202b6ba7 (patch)
tree40b3e7aff6eb5ce4209ea8d7b497033295598315 /cddl
parentacc544729384fb73fa14d6ca3b580dcc442df7f3 (diff)
downloadFreeBSD-src-9db99dff71d01cbbaa246dc65ca4ebd4202b6ba7.zip
FreeBSD-src-9db99dff71d01cbbaa246dc65ca4ebd4202b6ba7.tar.gz
MFV r268848:
Instead of asserting all zio's be properly aligned, only assert on the logical ones. Cap uberblocks at 8k, otherwise with ashift=17, there would be only one uberblock. This fixes a problem that zdb would trip assert on pools with ashift >= 0xe (8k). While there, also change the code so it only attempt to condense space map unless the uncondensed size consumes greater than zfs_metaslab_condense_block_threshold blocks. Illumos issue: 4958 zdb trips assert on pools with ashift >= 0xe MFC after: 2 weeks
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/cmd/ztest/ztest.c43
1 files changed, 37 insertions, 6 deletions
diff --git a/cddl/contrib/opensolaris/cmd/ztest/ztest.c b/cddl/contrib/opensolaris/cmd/ztest/ztest.c
index 8f5d7ce..3327161 100644
--- a/cddl/contrib/opensolaris/cmd/ztest/ztest.c
+++ b/cddl/contrib/opensolaris/cmd/ztest/ztest.c
@@ -810,7 +810,7 @@ static uint64_t
ztest_get_ashift(void)
{
if (ztest_opts.zo_ashift == 0)
- return (SPA_MINBLOCKSHIFT + ztest_random(3));
+ return (SPA_MINBLOCKSHIFT + ztest_random(5));
return (ztest_opts.zo_ashift);
}
@@ -969,11 +969,28 @@ ztest_random_spa_version(uint64_t initial_version)
return (version);
}
+/*
+ * Find the largest ashift used
+ */
+static uint64_t
+ztest_spa_get_ashift() {
+ uint64_t i;
+ uint64_t ashift = SPA_MINBLOCKSHIFT;
+ vdev_t *rvd = ztest_spa->spa_root_vdev;
+
+ for (i = 0; i < rvd->vdev_children; i++) {
+ ashift = MAX(ashift, rvd->vdev_child[i]->vdev_ashift);
+ }
+ return (ashift);
+}
+
static int
ztest_random_blocksize(void)
{
- return (1 << (SPA_MINBLOCKSHIFT +
- ztest_random(SPA_MAXBLOCKSHIFT - SPA_MINBLOCKSHIFT + 1)));
+ // Choose a block size >= the ashift.
+ uint64_t block_shift =
+ ztest_random(SPA_MAXBLOCKSHIFT - ztest_spa_get_ashift() + 1);
+ return (1 << (SPA_MINBLOCKSHIFT + block_shift));
}
static int
@@ -5768,16 +5785,30 @@ ztest_freeze(void)
spa_freeze(spa);
/*
+ * Because it is hard to predict how much space a write will actually
+ * require beforehand, we leave ourselves some fudge space to write over
+ * capacity.
+ */
+ uint64_t capacity = metaslab_class_get_space(spa_normal_class(spa)) / 2;
+
+ /*
* Run tests that generate log records but don't alter the pool config
* or depend on DSL sync tasks (snapshots, objset create/destroy, etc).
* We do a txg_wait_synced() after each iteration to force the txg
* to increase well beyond the last synced value in the uberblock.
* The ZIL should be OK with that.
+ *
+ * Run a random number of times less than zo_maxloops and ensure we do
+ * not run out of space on the pool.
*/
while (ztest_random(10) != 0 &&
- numloops++ < ztest_opts.zo_maxloops) {
- ztest_dmu_write_parallel(zd, 0);
- ztest_dmu_object_alloc_free(zd, 0);
+ numloops++ < ztest_opts.zo_maxloops &&
+ metaslab_class_get_alloc(spa_normal_class(spa)) < capacity) {
+ ztest_od_t od;
+ ztest_od_init(&od, 0, FTAG, 0, DMU_OT_UINT64_OTHER, 0, 0);
+ VERIFY0(ztest_object_init(zd, &od, sizeof (od), B_FALSE));
+ ztest_io(zd, od.od_object,
+ ztest_random(ZTEST_RANGE_LOCKS) << SPA_MAXBLOCKSHIFT);
txg_wait_synced(spa_get_dsl(spa), 0);
}
OpenPOWER on IntegriCloud