mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::fs: Add runtime support indicators for write_life related features.
This commit is contained in:
parent
82200a9abd
commit
861df761fe
2 changed files with 26 additions and 0 deletions
|
@ -43,6 +43,8 @@ namespace ircd::fs
|
|||
extern const bool support_hipri;
|
||||
extern const bool support_sync;
|
||||
extern const bool support_dsync;
|
||||
extern const bool support_rwh_write_life;
|
||||
extern const bool support_rwf_write_life;
|
||||
|
||||
// Log facility for ircd::fs
|
||||
extern log::log log;
|
||||
|
|
24
ircd/fs.cc
24
ircd/fs.cc
|
@ -99,6 +99,27 @@ ircd::fs::support_append
|
|||
#endif
|
||||
};
|
||||
|
||||
decltype(ircd::fs::support_rwh_write_life)
|
||||
ircd::fs::support_rwh_write_life
|
||||
{
|
||||
#if defined(HAVE_FCNTL_H) && defined(F_SET_FILE_RW_HINT)
|
||||
info::kversion[0] >= 4 &&
|
||||
info::kversion[1] >= 13
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
};
|
||||
|
||||
decltype(ircd::fs::support_rwf_write_life)
|
||||
ircd::fs::support_rwf_write_life
|
||||
{
|
||||
#if defined(RWF_WRITE_LIFE_SHIFT)
|
||||
false //TODO: XXX
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
// init
|
||||
//
|
||||
|
@ -1508,6 +1529,9 @@ void
|
|||
ircd::fs::write_life(const fd &fd,
|
||||
const uint64_t &hint)
|
||||
{
|
||||
if(!support_rwh_write_life)
|
||||
return;
|
||||
|
||||
syscall(::fcntl, int(fd), F_SET_FILE_RW_HINT, &hint);
|
||||
}
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue