From 2d33c8edb67ebf070039b84ab2e1f5d07814a916 Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Fri, 30 May 2025 21:13:49 -0400 Subject: [PATCH] Make rewrite use Uncached I/O Rewrite is a one-time/rare bulk administrative operation, which should minimally affect payload caching. Plus some avoided memory copies in its data path allow to significantly increase its speed. My tests show reduction of time to rewrite 28GB of uncompressed files on NVMe pool from 17 to 9 seconds and minimal ARC usage. Reviewed-by: Brian Behlendorf Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. Closes #17407 --- module/zfs/zfs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index b134a09c7..a0e74f9a7 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -1178,7 +1178,7 @@ zfs_rewrite(znode_t *zp, uint64_t off, uint64_t len, uint64_t flags, dmu_buf_t **dbp; int numbufs; error = dmu_buf_hold_array_by_dnode(dn, off, n, TRUE, FTAG, - &numbufs, &dbp, DMU_READ_PREFETCH); + &numbufs, &dbp, DMU_READ_PREFETCH | DMU_UNCACHEDIO); if (error) { dmu_tx_abort(tx); break;