mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 19:28:53 +03:00
Avoid small buffer copying on write
It is wrong for arc_write_ready() to use zfs_abd_scatter_enabled to decide whether to reallocate/copy the buffer, because the answer is OS-specific and depends on the buffer size. Instead of that use abd_size_alloc_linear(), moved into public header. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Brian Atkinson <batkinson@lanl.gov> Signed-off-by: Alexander Motin <mav@FreeBSD.org> Closes #12425
This commit is contained in:
+2
-1
@@ -6872,7 +6872,8 @@ arc_write_ready(zio_t *zio)
|
||||
ASSERT(ARC_BUF_COMPRESSED(buf));
|
||||
arc_hdr_alloc_abd(hdr, ARC_HDR_DO_ADAPT|ARC_HDR_ALLOC_RDATA);
|
||||
abd_copy(hdr->b_crypt_hdr.b_rabd, zio->io_abd, psize);
|
||||
} else if (zfs_abd_scatter_enabled || !arc_can_share(hdr, buf)) {
|
||||
} else if (!abd_size_alloc_linear(arc_buf_size(buf)) ||
|
||||
!arc_can_share(hdr, buf)) {
|
||||
/*
|
||||
* Ideally, we would always copy the io_abd into b_pabd, but the
|
||||
* user may have disabled compressed ARC, thus we must check the
|
||||
|
||||
Reference in New Issue
Block a user