mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Remove dependency on linear ABD
Wherever possible it's best to avoid depending on a linear ABD. Update the code accordingly in the following areas. - vdev_raidz - zio, zio_checksum - zfs_fm - change abd_alloc_for_io() to use abd_alloc() Reviewed-by: David Quigley <david.quigley@intel.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Gvozden Neskovic <neskovic@gmail.com> Closes #5668
This commit is contained in:
committed by
Brian Behlendorf
parent
2035575fd6
commit
84c07adadb
+14
-15
@@ -310,6 +310,12 @@ zio_data_buf_free(void *buf, size_t size)
|
||||
kmem_cache_free(zio_data_buf_cache[c], buf);
|
||||
}
|
||||
|
||||
static void
|
||||
zio_abd_free(void *abd, size_t size)
|
||||
{
|
||||
abd_free((abd_t *)abd);
|
||||
}
|
||||
|
||||
/*
|
||||
* ==========================================================================
|
||||
* Push and pop I/O transform buffers
|
||||
@@ -3332,7 +3338,7 @@ zio_vdev_io_done(zio_t *zio)
|
||||
*/
|
||||
static void
|
||||
zio_vsd_default_cksum_finish(zio_cksum_report_t *zcr,
|
||||
const void *good_buf)
|
||||
const abd_t *good_buf)
|
||||
{
|
||||
/* no processing needed */
|
||||
zfs_ereport_finish_checksum(zcr, good_buf, zcr->zcr_cbdata, B_FALSE);
|
||||
@@ -3342,14 +3348,14 @@ zio_vsd_default_cksum_finish(zio_cksum_report_t *zcr,
|
||||
void
|
||||
zio_vsd_default_cksum_report(zio_t *zio, zio_cksum_report_t *zcr, void *ignored)
|
||||
{
|
||||
void *buf = zio_buf_alloc(zio->io_size);
|
||||
void *abd = abd_alloc_sametype(zio->io_abd, zio->io_size);
|
||||
|
||||
abd_copy_to_buf(buf, zio->io_abd, zio->io_size);
|
||||
abd_copy(abd, zio->io_abd, zio->io_size);
|
||||
|
||||
zcr->zcr_cbinfo = zio->io_size;
|
||||
zcr->zcr_cbdata = buf;
|
||||
zcr->zcr_cbdata = abd;
|
||||
zcr->zcr_finish = zio_vsd_default_cksum_finish;
|
||||
zcr->zcr_free = zio_buf_free;
|
||||
zcr->zcr_free = zio_abd_free;
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -3706,7 +3712,7 @@ zio_done(zio_t *zio)
|
||||
* Always attempt to keep stack usage minimal here since
|
||||
* we can be called recurisvely up to 19 levels deep.
|
||||
*/
|
||||
uint64_t psize = zio->io_size;
|
||||
const uint64_t psize = zio->io_size;
|
||||
zio_t *pio, *pio_next;
|
||||
int c, w;
|
||||
zio_link_t *zl = NULL;
|
||||
@@ -3788,26 +3794,19 @@ zio_done(zio_t *zio)
|
||||
zio_cksum_report_t *zcr = zio->io_cksum_report;
|
||||
uint64_t align = zcr->zcr_align;
|
||||
uint64_t asize = P2ROUNDUP(psize, align);
|
||||
char *abuf = NULL;
|
||||
abd_t *adata = zio->io_abd;
|
||||
|
||||
if (asize != psize) {
|
||||
adata = abd_alloc_linear(asize, B_TRUE);
|
||||
adata = abd_alloc(asize, B_TRUE);
|
||||
abd_copy(adata, zio->io_abd, psize);
|
||||
abd_zero_off(adata, psize, asize - psize);
|
||||
}
|
||||
|
||||
if (adata != NULL)
|
||||
abuf = abd_borrow_buf_copy(adata, asize);
|
||||
|
||||
zio->io_cksum_report = zcr->zcr_next;
|
||||
zcr->zcr_next = NULL;
|
||||
zcr->zcr_finish(zcr, abuf);
|
||||
zcr->zcr_finish(zcr, adata);
|
||||
zfs_ereport_free_checksum(zcr);
|
||||
|
||||
if (adata != NULL)
|
||||
abd_return_buf(adata, abuf, asize);
|
||||
|
||||
if (asize != psize)
|
||||
abd_free(adata);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user