Commit ccb4bc77 authored by Daniel Black's avatar Daniel Black

MDEV-33894: Resurrect innodb_log_write_ahead_size (postfix)

os_file_log_maybe_unbuffered is now Linux only.

Aso the stat st structure only used in linux.

This avoids unused function/structure errors on FreeBSD.
parent 852d42e9
...@@ -1095,13 +1095,11 @@ static ATTRIBUTE_COLD void os_file_log_buffered() ...@@ -1095,13 +1095,11 @@ static ATTRIBUTE_COLD void os_file_log_buffered()
log_sys.log_maybe_unbuffered= false; log_sys.log_maybe_unbuffered= false;
log_sys.log_buffered= true; log_sys.log_buffered= true;
} }
# endif
/** @return whether the log file may work with unbuffered I/O. */ /** @return whether the log file may work with unbuffered I/O. */
static ATTRIBUTE_COLD bool os_file_log_maybe_unbuffered(const struct stat &st) static ATTRIBUTE_COLD bool os_file_log_maybe_unbuffered(const struct stat &st)
{ {
MSAN_STAT_WORKAROUND(&st); MSAN_STAT_WORKAROUND(&st);
# ifdef __linux__
char b[20 + sizeof "/sys/dev/block/" ":" "/../queue/physical_block_size"]; char b[20 + sizeof "/sys/dev/block/" ":" "/../queue/physical_block_size"];
if (snprintf(b, sizeof b, "/sys/dev/block/%u:%u/queue/physical_block_size", if (snprintf(b, sizeof b, "/sys/dev/block/%u:%u/queue/physical_block_size",
major(st.st_dev), minor(st.st_dev)) >= major(st.st_dev), minor(st.st_dev)) >=
...@@ -1133,13 +1131,11 @@ static ATTRIBUTE_COLD bool os_file_log_maybe_unbuffered(const struct stat &st) ...@@ -1133,13 +1131,11 @@ static ATTRIBUTE_COLD bool os_file_log_maybe_unbuffered(const struct stat &st)
if (s > 4096 || s < 64 || !ut_is_2pow(s)) if (s > 4096 || s < 64 || !ut_is_2pow(s))
return false; return false;
log_sys.set_block_size(uint32_t(s)); log_sys.set_block_size(uint32_t(s));
# else
constexpr unsigned long s= 4096;
# endif
return !(st.st_size & (s - 1)); return !(st.st_size & (s - 1));
} }
#endif # endif /* __linux__ */
#endif /* O_DIRECT */
/** NOTE! Use the corresponding macro os_file_create(), not directly /** NOTE! Use the corresponding macro os_file_create(), not directly
this function! this function!
...@@ -1192,7 +1188,9 @@ os_file_create_func( ...@@ -1192,7 +1188,9 @@ os_file_create_func(
} }
#ifdef O_DIRECT #ifdef O_DIRECT
# ifdef __linux__
struct stat st; struct stat st;
# endif
ut_a(type == OS_LOG_FILE ut_a(type == OS_LOG_FILE
|| type == OS_DATA_FILE || type == OS_DATA_FILE_NO_O_DIRECT); || type == OS_DATA_FILE || type == OS_DATA_FILE_NO_O_DIRECT);
int direct_flag = 0; int direct_flag = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment