0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::db: Precache required buffer alignment of random access file for repeat calls.

This commit is contained in:
Jason Volk 2018-10-18 08:27:03 -07:00
parent c0058aa53c
commit 9da3d20e5c
2 changed files with 7 additions and 7 deletions

View file

@ -26,6 +26,7 @@ struct ircd::db::database::env::random_access_file final
database &d; database &d;
fs::fd::opts opts; fs::fd::opts opts;
fs::fd fd; fs::fd fd;
size_t _buffer_align;
bool use_direct_io() const noexcept override; bool use_direct_io() const noexcept override;
size_t GetRequiredBufferAlignment() const noexcept override; size_t GetRequiredBufferAlignment() const noexcept override;

View file

@ -5179,6 +5179,10 @@ try
{ {
name, this->opts name, this->opts
} }
,_buffer_align
{
fs::block_size(fd)
}
{ {
#ifdef RB_DEBUG_DB_ENV #ifdef RB_DEBUG_DB_ENV
log::debug log::debug
@ -5417,11 +5421,6 @@ size_t
ircd::db::database::env::random_access_file::GetRequiredBufferAlignment() ircd::db::database::env::random_access_file::GetRequiredBufferAlignment()
const noexcept const noexcept
{ {
const auto ret
{
fs::block_size(fd)
};
#ifdef RB_DEBUG_DB_ENV #ifdef RB_DEBUG_DB_ENV
log::debug log::debug
{ {
@ -5429,11 +5428,11 @@ const noexcept
d.name, d.name,
this, this,
int(fd), int(fd),
ret _buffer_align
}; };
#endif #endif
return ret; return _buffer_align;
} }
// //