mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
ircd::fs: Add slice usage warning reasons; simplify conditional logic.
This commit is contained in:
parent
a7b2f76c11
commit
81ca6fecf4
1 changed files with 16 additions and 3 deletions
17
ircd/fs.cc
17
ircd/fs.cc
|
@ -503,6 +503,11 @@ void
|
|||
ircd::fs::sync(const fd &fd,
|
||||
const sync_opts &opts)
|
||||
{
|
||||
const ctx::slice_usage_warning message
|
||||
{
|
||||
"fs::sync(fd:%d)", int(fd)
|
||||
};
|
||||
|
||||
#ifdef __linux__
|
||||
syscall(::syncfs, fd);
|
||||
#else
|
||||
|
@ -523,13 +528,22 @@ void
|
|||
ircd::fs::flush(const fd &fd,
|
||||
const sync_opts &opts)
|
||||
{
|
||||
const ctx::slice_usage_warning message
|
||||
{
|
||||
"fs::flush(fd:%d, {metadata:%b aio:%b:%b})",
|
||||
int(fd),
|
||||
opts.metadata,
|
||||
opts.aio,
|
||||
opts.metadata? support::aio_fdsync : support::aio_fsync
|
||||
};
|
||||
|
||||
#ifdef IRCD_USE_AIO
|
||||
if(aio::context && opts.aio)
|
||||
{
|
||||
if(!opts.metadata && support::aio_fdsync)
|
||||
return aio::fdsync(fd, opts);
|
||||
|
||||
if(opts.metadata && support::aio_fsync)
|
||||
if(support::aio_fsync)
|
||||
return aio::fsync(fd, opts);
|
||||
}
|
||||
#endif
|
||||
|
@ -537,7 +551,6 @@ ircd::fs::flush(const fd &fd,
|
|||
if(!opts.metadata)
|
||||
return void(syscall(::fdatasync, fd));
|
||||
|
||||
if(opts.metadata)
|
||||
return void(syscall(::fsync, fd));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue