Fix read/write behavior and return value depending on direct_io

Also add parallel direct write option for 6.2+ kernels.
This commit is contained in:
Antonio SJ Musumeci 2023-06-18 00:31:59 -05:00
parent 82430e1079
commit 6a14a10e6c
19 changed files with 531 additions and 158 deletions

View file

@ -23,17 +23,29 @@
#include <stdlib.h>
#include <string.h>
typedef struct fuse_bufvec fuse_bufvec;
namespace l
{
static
int
read(const int fd_,
char *buf_,
const size_t size_,
const off_t offset_)
read_direct_io(const int fd_,
char *buf_,
const size_t size_,
const off_t offset_)
{
int rv;
rv = fs::pread(fd_,buf_,size_,offset_);
return rv;
}
static
int
read_cached(const int fd_,
char *buf_,
const size_t size_,
const off_t offset_)
{
int rv;
@ -53,10 +65,10 @@ namespace FUSE
{
FileInfo *fi = reinterpret_cast<FileInfo*>(ffi_->fh);
return l::read(fi->fd,
buf_,
size_,
offset_);
if(fi->direct_io)
return l::read_direct_io(fi->fd,buf_,size_,offset_);
return l::read_cached(fi->fd,buf_,size_,offset_);
}
int