mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-01-14 01:02:04 +03:00
raidz_test: Fix ZIO ABDs initialization
- When filling ABDs of several segments, consider offset. - "Corrupt" ABDs with actually different data to fail something. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rob Norris <robn@despairlabs.com> Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com> Closes #17977
This commit is contained in:
parent
001ce40cd4
commit
6e10a51b74
@ -264,9 +264,21 @@ cmp_data(raidz_test_opts_t *opts, raidz_map_t *rm)
|
||||
|
||||
static int
|
||||
init_rand(void *data, size_t size, void *private)
|
||||
{
|
||||
size_t *offsetp = (size_t *)private;
|
||||
size_t offset = *offsetp;
|
||||
|
||||
VERIFY3U(offset + size, <=, SPA_MAXBLOCKSIZE);
|
||||
memcpy(data, (char *)rand_data + offset, size);
|
||||
*offsetp = offset + size;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
corrupt_rand_fill(void *data, size_t size, void *private)
|
||||
{
|
||||
(void) private;
|
||||
memcpy(data, rand_data, size);
|
||||
memset(data, 0xAA, size);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -278,7 +290,7 @@ corrupt_colums(raidz_map_t *rm, const int *tgts, const int cnt)
|
||||
for (int i = 0; i < cnt; i++) {
|
||||
raidz_col_t *col = &rr->rr_col[tgts[i]];
|
||||
abd_iterate_func(col->rc_abd, 0, col->rc_size,
|
||||
init_rand, NULL);
|
||||
corrupt_rand_fill, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -286,7 +298,8 @@ corrupt_colums(raidz_map_t *rm, const int *tgts, const int cnt)
|
||||
void
|
||||
init_zio_abd(zio_t *zio)
|
||||
{
|
||||
abd_iterate_func(zio->io_abd, 0, zio->io_size, init_rand, NULL);
|
||||
size_t offset = 0;
|
||||
abd_iterate_func(zio->io_abd, 0, zio->io_size, init_rand, &offset);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Loading…
Reference in New Issue
Block a user