diff options
Diffstat (limited to 'tpool/tpool.h')
-rw-r--r-- | tpool/tpool.h | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/tpool/tpool.h b/tpool/tpool.h index 7ac6763ae23..87a0122adce 100644 --- a/tpool/tpool.h +++ b/tpool/tpool.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2019, 2020, MariaDB Corporation. +/* Copyright (C) 2019, 2021, MariaDB Corporation. This program is free software; you can redistribute itand /or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/ #ifdef LINUX_NATIVE_AIO #include <libaio.h> #endif +#ifdef HAVE_URING +#include <sys/uio.h> +#endif #ifdef _WIN32 #ifndef NOMINMAX #define NOMINMAX @@ -114,7 +117,7 @@ enum class aio_opcode AIO_PREAD, AIO_PWRITE }; -constexpr size_t MAX_AIO_USERDATA_LEN= 3 * sizeof(void*); +constexpr size_t MAX_AIO_USERDATA_LEN= 4 * sizeof(void*); /** IO control block, includes parameters for the IO, and the callback*/ @@ -123,6 +126,8 @@ struct aiocb :OVERLAPPED #elif defined LINUX_NATIVE_AIO :iocb +#elif defined HAVE_URING + :iovec #endif { native_file_handle m_fh; @@ -168,7 +173,17 @@ public: protected: static void synchronous(aiocb *cb); /** finish a partial read/write callback synchronously */ - static void finish_synchronous(aiocb *cb); + static inline void finish_synchronous(aiocb *cb) + { + if (!cb->m_err && cb->m_ret_len != cb->m_len) + { + /* partial read/write */ + cb->m_buffer= (char *) cb->m_buffer + cb->m_ret_len; + cb->m_len-= (unsigned int) cb->m_ret_len; + cb->m_offset+= cb->m_ret_len; + synchronous(cb); + } + } }; class timer @@ -183,18 +198,6 @@ class thread_pool; extern aio *create_simulated_aio(thread_pool *tp); -#ifndef DBUG_OFF -/* - This function is useful for debugging to make sure all mutexes are released - inside a task callback -*/ -void set_after_task_callback(callback_func_np cb); -void execute_after_task_callback(); -#define dbug_execute_after_task_callback() execute_after_task_callback() -#else -#define dbug_execute_after_task_callback() do{}while(0) -#endif - class thread_pool { protected: |