mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 10:54:35 +03:00
abd: lift ABD zero scan from zio_compress_data() to abd_cmp_zero()
It's now the caller's responsibility do special handling for holes if that's something it wants. This also makes zio_compress_data() and zio_decompress_data() properly the inverse of each other. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Tino Reichardt <milky-zfs@mcmilk.de> Reviewed-by: Jason Lee <jasonlee@lanl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <rob.norris@klarasystems.com> Closes #16326
This commit is contained in:
@@ -1050,6 +1050,31 @@ abd_cmp(abd_t *dabd, abd_t *sabd)
|
||||
abd_cmp_cb, NULL));
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if ABD content is all-zeroes.
|
||||
*/
|
||||
static int
|
||||
abd_cmp_zero_off_cb(void *data, size_t len, void *private)
|
||||
{
|
||||
(void) private;
|
||||
|
||||
/* This function can only check whole uint64s. Enforce that. */
|
||||
ASSERT0(P2PHASE(len, 8));
|
||||
|
||||
uint64_t *end = (uint64_t *)((char *)data + len);
|
||||
for (uint64_t *word = (uint64_t *)data; word < end; word++)
|
||||
if (*word != 0)
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
abd_cmp_zero_off(abd_t *abd, size_t off, size_t size)
|
||||
{
|
||||
return (abd_iterate_func(abd, off, size, abd_cmp_zero_off_cb, NULL));
|
||||
}
|
||||
|
||||
/*
|
||||
* Iterate over code ABDs and a data ABD and call @func_raidz_gen.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user