mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 11:18:52 +03:00
Wire O_DIRECT also to Uncached I/O (#17218)
Before Direct I/O was implemented, I've implemented lighter version I called Uncached I/O. It uses normal DMU/ARC data path with some optimizations, but evicts data from caches as soon as possible and reasonable. Originally I wired it only to a primarycache property, but now completing the integration all the way up to the VFS. While Direct I/O has the lowest possible memory bandwidth usage, it also has a significant number of limitations. It require I/Os to be page aligned, does not allow speculative prefetch, etc. The Uncached I/O does not have those limitations, but instead require additional memory copy, though still one less than regular cached I/O. As such it should fill the gap in between. Considering this I've disabled annoying EINVAL errors on misaligned requests, adding a tunable for those who wants to test their applications. To pass the information between the layers I had to change a number of APIs. But as side effect upper layers can now control not only the caching, but also speculative prefetch. I haven't wired it to VFS yet, since it require looking on some OS specifics. But while there I've implemented speculative prefetch of indirect blocks for Direct I/O, controllable via all the same mechanisms. Signed-off-by: Alexander Motin <mav@FreeBSD.org> Sponsored by: iXsystems, Inc. Fixes #17027 Reviewed-by: Rob Norris <robn@despairlabs.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
+4
-3
@@ -900,8 +900,9 @@ zvol_log_write(zvol_state_t *zv, dmu_tx_t *tx, uint64_t offset,
|
||||
itx = zil_itx_create(TX_WRITE, sizeof (*lr) +
|
||||
(wr_state == WR_COPIED ? len : 0));
|
||||
lr = (lr_write_t *)&itx->itx_lr;
|
||||
if (wr_state == WR_COPIED && dmu_read_by_dnode(zv->zv_dn,
|
||||
offset, len, lr+1, DMU_READ_NO_PREFETCH) != 0) {
|
||||
if (wr_state == WR_COPIED &&
|
||||
dmu_read_by_dnode(zv->zv_dn, offset, len, lr + 1,
|
||||
DMU_READ_NO_PREFETCH | DMU_KEEP_CACHING) != 0) {
|
||||
zil_itx_destroy(itx);
|
||||
itx = zil_itx_create(TX_WRITE, sizeof (*lr));
|
||||
lr = (lr_write_t *)&itx->itx_lr;
|
||||
@@ -994,7 +995,7 @@ zvol_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf,
|
||||
zgd->zgd_lr = zfs_rangelock_enter(&zv->zv_rangelock, offset,
|
||||
size, RL_READER);
|
||||
error = dmu_read_by_dnode(zv->zv_dn, offset, size, buf,
|
||||
DMU_READ_NO_PREFETCH);
|
||||
DMU_READ_NO_PREFETCH | DMU_KEEP_CACHING);
|
||||
} else { /* indirect write */
|
||||
ASSERT3P(zio, !=, NULL);
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user