DMU: Do not pre-read holes during write
commit1b310dfb1d5aa90db7d8c4ec8d6a92b4430b0496
authorAlexander Motin <mav@FreeBSD.org>
Wed, 11 Oct 2023 23:37:21 +0000 (11 19:37 -0400)
committerGitHub <noreply@github.com>
Wed, 11 Oct 2023 23:37:21 +0000 (11 16:37 -0700)
tree0e0c795f387a877db323dfe6ffde0cf388d0aa16
parent9facf2d1ad0c4857de1d47a2a14e882a3fb78b89
DMU: Do not pre-read holes during write

dmu_tx_check_ioerr() pre-reads blocks that are going to be dirtied
as part of transaction to both prefetch them and check for errors.
But it makes no sense to do it for holes, since there are no disk
reads to prefetch and there can be no errors.  On the other side
those blocks are anonymous, and they are freed immediately by the
dbuf_rele() without even being put into dbuf cache, so we just
burn CPU time on decompression and overheads and get absolutely
no result at the end.

Use of dbuf_hold_impl() with fail_sparse parameter allows to skip
the extra work, and on my tests with sequential 8KB writes to empty
ZVOL with 32KB blocks shows throughput increase from 1.7 to 2GB/s.

Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15371
module/zfs/dmu_tx.c