[Devel] [PATCH RHEL8 COMMIT] fuse: enable async_dio for pcs
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Apr 23 11:54:51 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.19
------>
commit 40a2ac0558bca2ee704fe0c36e08e292b08a18bd
Author: Maxim Patlasov <MPatlasov at parallels.com>
Date: Fri Apr 23 11:54:51 2021 +0300
fuse: enable async_dio for pcs
The patch preserve user-visible behaviour from 2.6.32-*:
1) If writeback_cache is enabled, process DIO in async way even if async_dio
is off.
2) If writeback_cache is enabled, never send read requests beyond EOF to
userspace.
Signed-off-by: Maxim Patlasov <MPatlasov at parallels.com>
---
fs/fuse/file.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index d764bbb4e61e..03499bb3ab5e 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -3469,7 +3469,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
ssize_t ret = 0;
struct file *file = iocb->ki_filp;
struct fuse_file *ff = file->private_data;
- bool async_dio = ff->fc->async_dio;
+ bool async_dio = ff->fc->async_dio | ff->fc->writeback_cache;
loff_t pos = 0;
struct inode *inode;
loff_t i_size;
@@ -3486,9 +3486,16 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
/* optimization for short read */
if (async_dio && iov_iter_rw(iter) != WRITE && offset + count > i_size) {
+ loff_t new_count;
+
if (offset >= i_size)
return 0;
- iov_iter_truncate(iter, fuse_round_up(ff->fc, i_size - offset));
+
+ new_count = i_size - offset;
+ if (!ff->fc->writeback_cache)
+ new_count = fuse_round_up(ff->fc, new_count);
+
+ iov_iter_truncate(iter, new_count);
count = iov_iter_count(iter);
}
More information about the Devel
mailing list