From 9da3d20e5c9fa628e0f86a4aa534386e1f1e535c Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 18 Oct 2018 08:27:03 -0700 Subject: [PATCH] ircd::db: Precache required buffer alignment of random access file for repeat calls. --- include/ircd/db/database/env/random_access_file.h | 1 + ircd/db.cc | 13 ++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/ircd/db/database/env/random_access_file.h b/include/ircd/db/database/env/random_access_file.h index bb03e7227..53ca9d1cf 100644 --- a/include/ircd/db/database/env/random_access_file.h +++ b/include/ircd/db/database/env/random_access_file.h @@ -26,6 +26,7 @@ struct ircd::db::database::env::random_access_file final database &d; fs::fd::opts opts; fs::fd fd; + size_t _buffer_align; bool use_direct_io() const noexcept override; size_t GetRequiredBufferAlignment() const noexcept override; diff --git a/ircd/db.cc b/ircd/db.cc index 1e0b78535..8552a1dad 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -5179,6 +5179,10 @@ try { name, this->opts } +,_buffer_align +{ + fs::block_size(fd) +} { #ifdef RB_DEBUG_DB_ENV log::debug @@ -5417,11 +5421,6 @@ size_t ircd::db::database::env::random_access_file::GetRequiredBufferAlignment() const noexcept { - const auto ret - { - fs::block_size(fd) - }; - #ifdef RB_DEBUG_DB_ENV log::debug { @@ -5429,11 +5428,11 @@ const noexcept d.name, this, int(fd), - ret + _buffer_align }; #endif - return ret; + return _buffer_align; } //