diff options
Diffstat (limited to 'storage/innobase/os/os0file.cc')
-rw-r--r-- | storage/innobase/os/os0file.cc | 78 |
1 files changed, 15 insertions, 63 deletions
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index ceb6c69aec8..2d04a7cddc9 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -1131,23 +1131,14 @@ os_file_create_tmpfile() { FILE* file = NULL; WAIT_ALLOW_WRITES(); - os_file_t fd = innobase_mysql_tmpfile(NULL); + File fd = mysql_tmpfile("ib"); - if (fd != OS_FILE_CLOSED) { -#ifdef _WIN32 - int crt_fd = _open_osfhandle((intptr_t)HANDLE(fd), 0); - if (crt_fd != -1) { - file = fdopen(crt_fd, "w+b"); - if (!file) { - close(crt_fd); - } - } -#else - file = fdopen(fd, "w+b"); + if (fd >= 0) { + file = my_fdopen(fd, 0, O_RDWR|O_TRUNC|O_CREAT|FILE_BINARY, + MYF(MY_WME)); if (!file) { - close(fd); + my_close(fd, MYF(MY_WME)); } -#endif } if (file == NULL) { @@ -1677,6 +1668,7 @@ LinuxAIOHandler::resubmit(Slot* slot) /* Resubmit an I/O request */ int ret = io_submit(m_array->io_ctx(m_segment), 1, &iocb); + srv_stats.buffered_aio_submitted.inc(); if (ret < -1) { errno = -ret; @@ -2041,6 +2033,7 @@ AIO::linux_dispatch(Slot* slot) io_ctx_index = (slot->pos * m_n_segments) / m_slots.size(); int ret = io_submit(m_aio_ctx[io_ctx_index], 1, &iocb); + srv_stats.buffered_aio_submitted.inc(); /* io_submit() returns number of successfully queued requests or -errno. */ @@ -2145,7 +2138,7 @@ and native aio. bool AIO::is_linux_native_aio_supported() { - int fd; + File fd; io_context_t io_ctx; char name[1000]; @@ -2158,7 +2151,7 @@ AIO::is_linux_native_aio_supported() } else if (!srv_read_only_mode) { /* Now check if tmpdir supports native aio ops. */ - fd = innobase_mysql_tmpfile(NULL); + fd = mysql_tmpfile("ib"); if (fd < 0) { ib::warn() @@ -2185,7 +2178,7 @@ AIO::is_linux_native_aio_supported() strcpy(name + dirnamelen, "ib_logfile0"); - fd = open(name, O_RDONLY | O_CLOEXEC); + fd = my_open(name, O_RDONLY | O_CLOEXEC, MYF(0)); if (fd == -1) { @@ -2223,6 +2216,7 @@ AIO::is_linux_native_aio_supported() } int err = io_submit(io_ctx, 1, &p_iocb); + srv_stats.buffered_aio_submitted.inc(); if (err >= 1) { /* Now collect the submitted IO request. */ @@ -2230,7 +2224,7 @@ AIO::is_linux_native_aio_supported() } ut_free(buf); - close(fd); + my_close(fd, MYF(MY_WME)); switch (err) { case 1: @@ -4699,48 +4693,6 @@ os_file_set_eof( return(SetEndOfFile(h)); } -/** This function can be called if one wants to post a batch of reads and -prefers an i/o-handler thread to handle them all at once later. You must -call os_aio_simulated_wake_handler_threads later to ensure the threads -are not left sleeping! */ -void -os_aio_simulated_put_read_threads_to_sleep() -{ - AIO::simulated_put_read_threads_to_sleep(); -} - -/** This function can be called if one wants to post a batch of reads and -prefers an i/o-handler thread to handle them all at once later. You must -call os_aio_simulated_wake_handler_threads later to ensure the threads -are not left sleeping! */ -void -AIO::simulated_put_read_threads_to_sleep() -{ - /* The idea of putting background IO threads to sleep is only for - Windows when using simulated AIO. Windows XP seems to schedule - background threads too eagerly to allow for coalescing during - readahead requests. */ - - if (srv_use_native_aio) { - /* We do not use simulated AIO: do nothing */ - - return; - } - - os_aio_recommend_sleep_for_read_threads = true; - - for (ulint i = 0; i < os_aio_n_segments; i++) { - AIO* array; - - get_array_and_local_segment(&array, i); - - if (array == s_reads) { - - os_event_reset(os_aio_segment_wait_events[i]); - } - } -} - #endif /* !_WIN32*/ /** Does a syncronous read or write depending upon the type specified @@ -5594,6 +5546,9 @@ AIO::AIO( ulint n, ulint segments) : +#ifdef WIN_ASYNC_IO + m_completion_port(new_completion_port()), +#endif m_slots(n), m_n_segments(segments), m_n_reserved() @@ -5601,9 +5556,6 @@ AIO::AIO( ,m_aio_ctx(), m_events(m_slots.size()) # endif /* LINUX_NATIVE_AIO */ -#ifdef WIN_ASYNC_IO - ,m_completion_port(new_completion_port()) -#endif { ut_a(n > 0); ut_a(m_n_segments > 0); |