mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Illumos 4958 zdb trips assert on pools with ashift >= 0xe
4958 zdb trips assert on pools with ashift >= 0xe Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Max Grossman <max.grossman@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Christopher Siden <christopher.siden@delphix.com> Approved by: Garrett D'Amore <garrett@damore.org> References: https://www.illumos.org/issues/4958 https://github.com/illumos/illumos-gate/commit/2a104a5 Porting notes: Keep the ZIO_FLAG_FASTWRITE define. This is for a feature present in Linux but not yet in *BSD. Ported by: Turbo Fredriksson <turbo@bayour.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #2697
This commit is contained in:
committed by
Brian Behlendorf
parent
adc90e9d94
commit
b02fe35d37
+37
-6
@@ -859,7 +859,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);
|
||||
}
|
||||
|
||||
@@ -1021,11 +1021,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
|
||||
@@ -5963,17 +5980,31 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user