From 8079810bdaccf5b95ab32444d94ac4e357fa540e Mon Sep 17 00:00:00 2001 From: Eric Herman Date: Tue, 31 Dec 2024 18:12:21 +0100 Subject: [PATCH] Avoid redfine of IO_SIZE if made configurable If the server is to make IO_SIZE configurable, we need to avoid either redefining it, or defining it to be different. See: https://github.com/MariaDB/server/pull/3726 Signed-off-by: Eric Herman --- include/ma_global.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/ma_global.h b/include/ma_global.h index 819a82737..6da1c89ad 100644 --- a/include/ma_global.h +++ b/include/ma_global.h @@ -433,11 +433,17 @@ typedef SOCKET_SIZE_TYPE size_socket; /* #define FN_UPPER_CASE TRUE */ /* - Io buffer size; Must be a power of 2 and a multiple of 512. May be - smaller what the disk page size. This influences the speed of the - isam btree library. eg to big to slow. + I/O buffer size. May be smaller than the disk page size. + This influences the speed of the isam btree library. E.g.: too big too slow. + 4096 is a common block size on SSDs. */ -#define IO_SIZE 4096 +#ifndef IO_SIZE +#define IO_SIZE 4096U +#endif +#if (IO_SIZE < 512) || (IO_SIZE & (IO_SIZE-1)) +#error "IO_SIZE must be a positive multiple of 512 and power of 2" +#endif + /* How much overhead does malloc have. The code often allocates something like 1024-MALLOC_OVERHEAD bytes