mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
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:
parent
b21172c609
commit
07e7d76b7c
18 changed files with 1673 additions and 20 deletions
|
|
@ -170,6 +170,29 @@ namespace l
|
|||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
passthrough(const fuse_context *fc_,
|
||||
fuse_file_info_t *ffi_)
|
||||
{
|
||||
int backing_id;
|
||||
FileInfo *fi;
|
||||
const ugid::SetRootGuard ugid;
|
||||
|
||||
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_,
|
||||
|
|
@ -208,6 +231,15 @@ namespace l
|
|||
}
|
||||
}
|
||||
|
||||
constexpr
|
||||
const
|
||||
uint64_t
|
||||
_(const PassthroughEnum e_,
|
||||
const uint64_t m_)
|
||||
{
|
||||
return ((((uint64_t)e_) << 32) | (m_ & O_ACCMODE));
|
||||
}
|
||||
|
||||
namespace FUSE
|
||||
{
|
||||
int
|
||||
|
|
@ -247,6 +279,23 @@ namespace FUSE
|
|||
fc->umask);
|
||||
}
|
||||
|
||||
if(rv != 0)
|
||||
return rv;
|
||||
|
||||
switch(_(cfg->passthrough,ffi_->flags))
|
||||
{
|
||||
case _(PassthroughEnum::r, O_RDONLY):
|
||||
case _(PassthroughEnum::r, O_RDWR):
|
||||
case _(PassthroughEnum::w, O_WRONLY):
|
||||
case _(PassthroughEnum::w, O_RDWR):
|
||||
case _(PassthroughEnum::ro,O_RDONLY):
|
||||
case _(PassthroughEnum::wo,O_WRONLY):
|
||||
case _(PassthroughEnum::rw,O_RDONLY):
|
||||
case _(PassthroughEnum::rw,O_WRONLY):
|
||||
case _(PassthroughEnum::rw,O_RDWR):
|
||||
return l::passthrough(fc,ffi_);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue