0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

ircd:;fs: Rename various fsync/sync related.

This commit is contained in:
Jason Volk 2018-12-13 16:54:09 -08:00
parent a3613b1f4c
commit 9d423f84d8
6 changed files with 31 additions and 31 deletions

View file

@ -86,7 +86,7 @@ enum ircd::fs::index
#include "aio.h"
#include "read.h"
#include "write.h"
#include "fsync.h"
#include "sync.h"
#include "stdin.h"
#include "support.h"

View file

@ -9,27 +9,27 @@
// full license for this software is available in the LICENSE file.
#pragma once
#define HAVE_IRCD_FS_FSYNC_H
#define HAVE_IRCD_FS_SYNC_H
namespace ircd::fs
{
struct fsync_opts extern const fsync_opts_default;
struct sync_opts extern const sync_opts_default;
void fdsync(const fd &, const fsync_opts & = fsync_opts_default);
void fsync(const fd &, const fsync_opts & = fsync_opts_default);
void sync(const fd &, const fsync_opts & = fsync_opts_default);
void fdsync(const fd &, const sync_opts & = sync_opts_default);
void fsync(const fd &, const sync_opts & = sync_opts_default);
void sync(const fd &, const sync_opts & = sync_opts_default);
}
/// Options for a write operation
struct ircd::fs::fsync_opts
struct ircd::fs::sync_opts
{
fsync_opts() = default;
sync_opts() = default;
/// Determines whether this operation is conducted via AIO. If not, a
/// direct syscall is made. Using AIO will only block one ircd::ctx while
/// a direct syscall will block the thread (all contexts). If AIO is not
/// available or enabled setting this has no effect.
bool async {true};
bool synchronous {false};
/// Request priority. This value is ignored by the kernel for the
/// operations provided by this interface. It is still provided for

View file

@ -28,7 +28,7 @@ namespace ircd::fs::aio
//
ircd::fs::aio::request::fsync::fsync(const int &fd,
const fsync_opts &opts)
const sync_opts &opts)
:request{fd}
{
aio_reqprio = reqprio(opts.priority);
@ -41,7 +41,7 @@ ircd::fs::aio::request::fsync::fsync(const int &fd,
void
ircd::fs::aio::fsync(const fd &fd,
const fsync_opts &opts)
const sync_opts &opts)
{
aio::request::fsync request
{
@ -56,7 +56,7 @@ ircd::fs::aio::fsync(const fd &fd,
//
ircd::fs::aio::request::fdsync::fdsync(const int &fd,
const fsync_opts &opts)
const sync_opts &opts)
:request{fd}
{
aio_reqprio = reqprio(opts.priority);
@ -69,7 +69,7 @@ ircd::fs::aio::request::fdsync::fdsync(const int &fd,
void
ircd::fs::aio::fdsync(const fd &fd,
const fsync_opts &opts)
const sync_opts &opts)
{
aio::request::fdsync request
{

View file

@ -19,8 +19,8 @@ namespace ircd::fs::aio
void prefetch(const fd &, const size_t &, const read_opts &);
size_t write(const fd &, const const_buffers &, const write_opts &);
size_t read(const fd &, const mutable_buffers &, const read_opts &);
void fdsync(const fd &, const fsync_opts &);
void fsync(const fd &, const fsync_opts &);
void fdsync(const fd &, const sync_opts &);
void fsync(const fd &, const sync_opts &);
}
/// AIO context instance from the kernel. Right now this is a singleton with
@ -101,12 +101,12 @@ struct ircd::fs::aio::request::write
struct ircd::fs::aio::request::fdsync
:request
{
fdsync(const int &fd, const fsync_opts &);
fdsync(const int &fd, const sync_opts &);
};
/// fsync request control block
struct ircd::fs::aio::request::fsync
:request
{
fsync(const int &fd, const fsync_opts &);
fsync(const int &fd, const sync_opts &);
};

View file

@ -4754,7 +4754,7 @@ noexcept try
};
#endif
fs::fsync_opts opts;
fs::sync_opts opts;
fs::fdsync(fd, opts);
return Status::OK();
}
@ -4801,7 +4801,7 @@ noexcept try
};
#endif
fs::fsync_opts opts;
fs::sync_opts opts;
fs::sync(fd, opts);
return Status::OK();
}
@ -4846,7 +4846,7 @@ noexcept try
};
#endif
fs::fsync_opts opts;
fs::sync_opts opts;
fs::fsync(fd, opts);
return Status::OK();
}
@ -6983,7 +6983,7 @@ noexcept try
};
#endif
fs::fsync_opts opts;
fs::sync_opts opts;
fs::fsync(fd, opts);
return Status::OK();
}
@ -7030,7 +7030,7 @@ noexcept try
};
#endif
fs::fsync_opts opts;
fs::sync_opts opts;
fs::sync(fd, opts);
return Status::OK();
}
@ -7077,7 +7077,7 @@ noexcept try
};
#endif
fs::fsync_opts opts;
fs::sync_opts opts;
fs::fdsync(fd, opts);
return Status::OK();
}

View file

@ -512,15 +512,15 @@ ircd::fs::stdin::tty::write(const string_view &buf)
///////////////////////////////////////////////////////////////////////////////
//
// fs/fsync.h
// fs/sync.h
//
ircd::fs::fsync_opts
const ircd::fs::fsync_opts_default;
ircd::fs::sync_opts
const ircd::fs::sync_opts_default;
void
ircd::fs::sync(const fd &fd,
const fsync_opts &opts)
const sync_opts &opts)
{
#ifdef __linux__
syscall(::syncfs, fd);
@ -531,10 +531,10 @@ ircd::fs::sync(const fd &fd,
void
ircd::fs::fsync(const fd &fd,
const fsync_opts &opts)
const sync_opts &opts)
{
#ifdef IRCD_USE_AIO
if(aio::context && opts.async && support::aio_fsync)
if(aio::context && !opts.synchronous && support::aio_fsync)
return aio::fsync(fd, opts);
#endif
@ -543,10 +543,10 @@ ircd::fs::fsync(const fd &fd,
void
ircd::fs::fdsync(const fd &fd,
const fsync_opts &opts)
const sync_opts &opts)
{
#ifdef IRCD_USE_AIO
if(aio::context && opts.async && support::aio_fdsync)
if(aio::context && !opts.synchronous && support::aio_fdsync)
return aio::fdsync(fd, opts);
#endif