mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-25 03:37:45 +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:
+6
-6
@@ -3065,7 +3065,7 @@ arc_unshare_buf(arc_buf_hdr_t *hdr, arc_buf_t *buf)
|
||||
arc_hdr_size(hdr), hdr, buf);
|
||||
arc_hdr_clear_flags(hdr, ARC_FLAG_SHARED_DATA);
|
||||
abd_release_ownership_of_buf(hdr->b_l1hdr.b_pabd);
|
||||
abd_put(hdr->b_l1hdr.b_pabd);
|
||||
abd_free(hdr->b_l1hdr.b_pabd);
|
||||
hdr->b_l1hdr.b_pabd = NULL;
|
||||
buf->b_flags &= ~ARC_BUF_FLAG_SHARED;
|
||||
|
||||
@@ -7047,7 +7047,7 @@ arc_write_done(zio_t *zio)
|
||||
ASSERT(!zfs_refcount_is_zero(&hdr->b_l1hdr.b_refcnt));
|
||||
callback->awcb_done(zio, buf, callback->awcb_private);
|
||||
|
||||
abd_put(zio->io_abd);
|
||||
abd_free(zio->io_abd);
|
||||
kmem_free(callback, sizeof (arc_write_callback_t));
|
||||
}
|
||||
|
||||
@@ -9043,7 +9043,7 @@ l2arc_blk_fetch_done(zio_t *zio)
|
||||
|
||||
cb = zio->io_private;
|
||||
if (cb->l2rcb_abd != NULL)
|
||||
abd_put(cb->l2rcb_abd);
|
||||
abd_free(cb->l2rcb_abd);
|
||||
kmem_free(cb, sizeof (l2arc_read_callback_t));
|
||||
}
|
||||
|
||||
@@ -10015,7 +10015,7 @@ l2arc_dev_hdr_read(l2arc_dev_t *dev)
|
||||
ZIO_FLAG_DONT_PROPAGATE | ZIO_FLAG_DONT_RETRY |
|
||||
ZIO_FLAG_SPECULATIVE, B_FALSE));
|
||||
|
||||
abd_put(abd);
|
||||
abd_free(abd);
|
||||
|
||||
if (err != 0) {
|
||||
ARCSTAT_BUMP(arcstat_l2_rebuild_abort_dh_errors);
|
||||
@@ -10383,7 +10383,7 @@ l2arc_dev_hdr_update(l2arc_dev_t *dev)
|
||||
VDEV_LABEL_START_SIZE, l2dhdr_asize, abd, ZIO_CHECKSUM_LABEL, NULL,
|
||||
NULL, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_CANFAIL, B_FALSE));
|
||||
|
||||
abd_put(abd);
|
||||
abd_free(abd);
|
||||
|
||||
if (err != 0) {
|
||||
zfs_dbgmsg("L2ARC IO error (%d) while writing device header, "
|
||||
@@ -10472,7 +10472,7 @@ l2arc_log_blk_commit(l2arc_dev_t *dev, zio_t *pio, l2arc_write_callback_t *cb)
|
||||
fletcher_4_native(tmpbuf, asize, NULL,
|
||||
&l2dhdr->dh_start_lbps[0].lbp_cksum);
|
||||
|
||||
abd_put(abd_buf->abd);
|
||||
abd_free(abd_buf->abd);
|
||||
|
||||
/* perform the write itself */
|
||||
abd_buf->abd = abd_get_from_buf(tmpbuf, sizeof (*lb));
|
||||
|
||||
Reference in New Issue
Block a user