Add support for file io passthrough

If using Linux 6.9 or above and enabled (passthrough=true) files
opened or created will use the FUSE passthrough feature.

If direct-io=true / cache.files=off it will override passthrough. If
direct-io-allow-mmap is enabled only mmap will passthrough.

HANDLE_KILLPRIV and V2 are enabled now by default to remove the
kernel's need to issue getattr and getxattr requests.

moveonenospc will not work when leveraging passthrough.
This commit is contained in:
Antonio SJ Musumeci 2024-03-24 23:32:26 -05:00
parent b21172c609
commit c9b7ed5b8a
13 changed files with 182 additions and 17 deletions

View file

@ -170,6 +170,28 @@ namespace l
return 0;
}
static
int
passthrough(const fuse_context *fc_,
fuse_file_info_t *ffi_)
{
int backing_id;
FileInfo *fi;
fi = reinterpret_cast<FileInfo*>(ffi_->fh);
backing_id = fuse_passthrough_open(fc_,fi->fd);
if(backing_id <= 0)
return 0;
ffi_->passthrough = true;
ffi_->keep_cache = false;
fi->backing_id = backing_id;
ffi_->backing_id = backing_id;
return 0;
}
static
int
create(const Policy::Search &searchFunc_,
@ -247,6 +269,9 @@ namespace FUSE
fc->umask);
}
return rv;
if((rv != 0) || (cfg->passthrough == false))
return rv;
return l::passthrough(fc,ffi_);
}
}