mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 02:49:32 +03:00
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
This commit is contained in:
parent
3f67e012e4
commit
e82e68400a
@ -210,10 +210,12 @@ dmu_tx_check_ioerr(zio_t *zio, dnode_t *dn, int level, uint64_t blkid)
|
|||||||
dmu_buf_impl_t *db;
|
dmu_buf_impl_t *db;
|
||||||
|
|
||||||
rw_enter(&dn->dn_struct_rwlock, RW_READER);
|
rw_enter(&dn->dn_struct_rwlock, RW_READER);
|
||||||
db = dbuf_hold_level(dn, level, blkid, FTAG);
|
err = dbuf_hold_impl(dn, level, blkid, TRUE, FALSE, FTAG, &db);
|
||||||
rw_exit(&dn->dn_struct_rwlock);
|
rw_exit(&dn->dn_struct_rwlock);
|
||||||
if (db == NULL)
|
if (err == ENOENT)
|
||||||
return (SET_ERROR(EIO));
|
return (0);
|
||||||
|
if (err != 0)
|
||||||
|
return (err);
|
||||||
/*
|
/*
|
||||||
* PARTIAL_FIRST allows caching for uncacheable blocks. It will
|
* PARTIAL_FIRST allows caching for uncacheable blocks. It will
|
||||||
* be cleared after dmu_buf_will_dirty() call dbuf_read() again.
|
* be cleared after dmu_buf_will_dirty() call dbuf_read() again.
|
||||||
|
Loading…
Reference in New Issue
Block a user