0
0
Fork 0
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:
Jason Volk 2018-12-13 18:03:17 -08:00
parent 5e8d5562da
commit c4d5f03725
3 changed files with 34 additions and 2 deletions

View file

@ -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);
}

View file

@ -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)
{

View file

@ -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)