mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 11:47:43 +03:00
allow callers to allocate and provide the abd_t struct
The `abd_get_offset_*()` routines create an abd_t that references another abd_t, and doesn't allocate any pages/buffers of its own. In some workloads, these routines may be called frequently, to create many abd_t's representing small pieces of a single large abd_t. In particular, the upcoming RAIDZ Expansion project makes heavy use of these routines. This commit adds the ability for the caller to allocate and provide the abd_t struct to a variant of `abd_get_offset_*()`. This eliminates the cost of allocating the abd_t and performing the accounting associated with it (`abdstat_struct_size`). The RAIDZ/DRAID code uses this for the `rc_abd`, which references the zio's abd. The upcoming RAIDZ Expansion project will leverage this infrastructure to increase performance of reads post-expansion by around 50%. Additionally, some of the interfaces around creating and destroying abd_t's are cleaned up. Most significantly, the distinction between `abd_put()` and `abd_free()` is eliminated; all types of abd_t's are now disposed of with `abd_free()`. Reviewed-by: Brian Atkinson <batkinson@lanl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matthew Ahrens <mahrens@delphix.com> Issue #8853 Closes #11439
This commit is contained in:
+4
-4
@@ -2450,7 +2450,7 @@ zio_resume_wait(spa_t *spa)
|
||||
static void
|
||||
zio_gang_issue_func_done(zio_t *zio)
|
||||
{
|
||||
abd_put(zio->io_abd);
|
||||
abd_free(zio->io_abd);
|
||||
}
|
||||
|
||||
static zio_t *
|
||||
@@ -2494,7 +2494,7 @@ zio_rewrite_gang(zio_t *pio, blkptr_t *bp, zio_gang_node_t *gn, abd_t *data,
|
||||
zio_checksum_compute(zio, BP_GET_CHECKSUM(bp),
|
||||
buf, BP_GET_PSIZE(bp));
|
||||
|
||||
abd_put(buf);
|
||||
abd_free(buf);
|
||||
}
|
||||
/*
|
||||
* If we are here to damage data for testing purposes,
|
||||
@@ -2622,7 +2622,7 @@ zio_gang_tree_assemble_done(zio_t *zio)
|
||||
ASSERT(zio->io_size == SPA_GANGBLOCKSIZE);
|
||||
ASSERT(gn->gn_gbh->zg_tail.zec_magic == ZEC_MAGIC);
|
||||
|
||||
abd_put(zio->io_abd);
|
||||
abd_free(zio->io_abd);
|
||||
|
||||
for (int g = 0; g < SPA_GBH_NBLKPTRS; g++) {
|
||||
blkptr_t *gbp = &gn->gn_gbh->zg_blkptr[g];
|
||||
@@ -2746,7 +2746,7 @@ zio_write_gang_done(zio_t *zio)
|
||||
* check for it here as it is cleared in zio_ready.
|
||||
*/
|
||||
if (zio->io_abd != NULL)
|
||||
abd_put(zio->io_abd);
|
||||
abd_free(zio->io_abd);
|
||||
}
|
||||
|
||||
static zio_t *
|
||||
|
||||
Reference in New Issue
Block a user