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:
Alexander Motin
2021-07-27 19:05:47 -04:00
committed by Brian Behlendorf
parent 5b860ae1fb
commit 415882d228
6 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -638,7 +638,7 @@ abd_alloc_zero_scatter(void)
boolean_t
abd_size_alloc_linear(size_t size)
{
return (size < zfs_abd_scatter_min_size ? B_TRUE : B_FALSE);
return (!zfs_abd_scatter_enabled || size < zfs_abd_scatter_min_size);
}
void