summaryrefslogtreecommitdiff
path: root/storage/innobase/fil/fil0fil.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/fil/fil0fil.c')
-rw-r--r--storage/innobase/fil/fil0fil.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index 299b55f3d2b..20f522c1a60 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
@@ -3410,9 +3410,9 @@ fil_extend_space_to_desired_size(
fil_space_t* space;
byte* buf2;
byte* buf;
+ ulint buf_size;
ulint start_page_no;
ulint file_start_page_no;
- ulint n_pages;
ulint offset_high;
ulint offset_low;
ibool success = TRUE;
@@ -3437,22 +3437,20 @@ fil_extend_space_to_desired_size(
fil_node_prepare_for_io(node, system, space);
- /* Extend 1 MB at a time */
-
- buf2 = mem_alloc(1024 * 1024 + UNIV_PAGE_SIZE);
- buf = ut_align(buf2, UNIV_PAGE_SIZE);
-
- memset(buf, '\0', 1024 * 1024);
-
start_page_no = space->size;
file_start_page_no = space->size - node->size;
- while (start_page_no < size_after_extend) {
- n_pages = size_after_extend - start_page_no;
+ /* Extend at most 64 pages at a time */
+ buf_size = ut_min(64, size_after_extend - start_page_no)
+ * UNIV_PAGE_SIZE;
+ buf2 = mem_alloc(buf_size + UNIV_PAGE_SIZE);
+ buf = ut_align(buf2, UNIV_PAGE_SIZE);
- if (n_pages > (1024 * 1024) / UNIV_PAGE_SIZE) {
- n_pages = (1024 * 1024) / UNIV_PAGE_SIZE;
- }
+ memset(buf, 0, buf_size);
+
+ while (start_page_no < size_after_extend) {
+ ulint n_pages = ut_min(buf_size / UNIV_PAGE_SIZE,
+ size_after_extend - start_page_no);
offset_high = (start_page_no - file_start_page_no)
/ (4096 * ((1024 * 1024) / UNIV_PAGE_SIZE));
@@ -4034,7 +4032,7 @@ fil_aio_wait(
if (os_aio_use_native_aio) {
srv_set_io_thread_op_info(segment, "native aio handle");
#ifdef WIN_ASYNC_IO
- ret = os_aio_windows_handle(segment, 0, (void**) &fil_node,
+ ret = os_aio_windows_handle(segment, 0, &fil_node,
&message, &type);
#elif defined(POSIX_ASYNC_IO)
ret = os_aio_posix_handle(segment, &fil_node, &message);