fuse: introduce inode io modes
authorAmir Goldstein <amir73il@gmail.com>
Thu, 1 Feb 2024 14:26:15 +0000 (16:26 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 23 Feb 2024 16:36:32 +0000 (17:36 +0100)
commitcb098dd24bab8a315aa00bab1ccddb6be872156d
treedbf154286a97aab4bbed70abf7f77e4e0ed87159
parentd2c487f150ae00e3cb9faf57aceacc584e0a130c
fuse: introduce inode io modes

The fuse inode io mode is determined by the mode of its open files/mmaps
and parallel dio opens and expressed in the value of fi->iocachectr:

 > 0 - caching io: files open in caching mode or mmap on direct_io file
 < 0 - parallel dio: direct io mode with parallel dio writes enabled
== 0 - direct io: no files open in caching mode and no files mmaped

Note that iocachectr value of 0 might become positive or negative,
while non-parallel dio is getting processed.

direct_io mmap uses page cache, so first mmap will mark the file as
ff->io_opened and increment fi->iocachectr to enter the caching io mode.

If the server opens the file in caching mode while it is already open
for parallel dio or vice versa the open fails.

This allows executing parallel dio when inode is not in caching mode
and no mmaps have been performed on the inode in question.

Signed-off-by: Bernd Schubert <bschubert@ddn.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/Makefile
fs/fuse/file.c
fs/fuse/fuse_i.h
fs/fuse/iomode.c [new file with mode: 0644]