mirror of
https://github.com/matrix-construct/construct
synced 2024-06-10 22:18:54 +02:00
ircd::fs: Add compat interface for range flush()/sync().
This commit is contained in:
parent
5e8d5562da
commit
c4d5f03725
|
@ -15,7 +15,10 @@ namespace ircd::fs
|
|||
{
|
||||
struct sync_opts extern const sync_opts_default;
|
||||
|
||||
void flush(const fd &, const off_t &, const size_t &, const sync_opts & = sync_opts_default);
|
||||
void flush(const fd &, const sync_opts & = sync_opts_default);
|
||||
|
||||
void sync(const fd &, const off_t &, const size_t &, const sync_opts & = sync_opts_default);
|
||||
void sync(const fd &, const sync_opts & = sync_opts_default);
|
||||
}
|
||||
|
||||
|
|
15
ircd/db.cc
15
ircd/db.cc
|
@ -4896,8 +4896,19 @@ noexcept try
|
|||
};
|
||||
#endif
|
||||
|
||||
assert(0);
|
||||
return Status::NotSupported();
|
||||
// RocksDB sez they want us to initiate flushing of dirty pages
|
||||
// asynchronously without waiting for completion. RocksDB allows
|
||||
// this callback to be a no-op and do nothing at all.
|
||||
//
|
||||
// We plug this into a "range flush" gimmick in ircd::fs which almost
|
||||
// certainly calls fdatasync() and ignores the range; it may one day
|
||||
// on supporting platforms and in certain circumstances call
|
||||
// sync_file_range() without any of the wait flags and respect the range.
|
||||
|
||||
fs::sync_opts opts;
|
||||
opts.metadata = false;
|
||||
fs::flush(fd, offset, length, opts);
|
||||
return Status::OK();
|
||||
}
|
||||
catch(const std::system_error &e)
|
||||
{
|
||||
|
|
18
ircd/fs.cc
18
ircd/fs.cc
|
@ -518,6 +518,15 @@ ircd::fs::stdin::tty::write(const string_view &buf)
|
|||
ircd::fs::sync_opts
|
||||
const ircd::fs::sync_opts_default;
|
||||
|
||||
void
|
||||
ircd::fs::sync(const fd &fd,
|
||||
const off_t &offset,
|
||||
const size_t &length,
|
||||
const sync_opts &opts)
|
||||
{
|
||||
return sync(fd, opts);
|
||||
}
|
||||
|
||||
void
|
||||
ircd::fs::sync(const fd &fd,
|
||||
const sync_opts &opts)
|
||||
|
@ -529,6 +538,15 @@ ircd::fs::sync(const fd &fd,
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
ircd::fs::flush(const fd &fd,
|
||||
const off_t &offset,
|
||||
const size_t &length,
|
||||
const sync_opts &opts)
|
||||
{
|
||||
return flush(fd, opts);
|
||||
}
|
||||
|
||||
void
|
||||
ircd::fs::flush(const fd &fd,
|
||||
const sync_opts &opts)
|
||||
|
|
Loading…
Reference in a new issue