@@ -119,7 +119,12 @@ buf_read_page_low(
119119 treat the tablespace as dropped; this is a timestamp we
120120 use to stop dangling page reads from a tablespace
121121 which we have DISCARDed + IMPORTed back */
122- ulint offset) /* !< in: page number */
122+ ulint offset, /* !< in: page number */
123+ ibool should_buffer) /* !< in: whether to buffer an aio request.
124+ AIO read-ahead uses this. if you plan to use this parameter,
125+ make sure you remember to call os_aio_linux_dispatch_read_array_submit
126+ when you are ready to commit all you requests. */
127+
123128{
124129 buf_page_t * bpage;
125130 ulint wake_later;
@@ -181,17 +186,17 @@ buf_read_page_low(
181186 }
182187
183188 if (zip_size) {
184- *err = fil_io (OS_FILE_READ | wake_later
189+ *err = _fil_io (OS_FILE_READ | wake_later
185190 | ignore_nonexistent_pages,
186191 sync, space, zip_size, offset, 0 , zip_size,
187- bpage->zip .data , bpage);
192+ bpage->zip .data , bpage, should_buffer );
188193 } else {
189194 ut_a (buf_page_get_state (bpage) == BUF_BLOCK_FILE_PAGE);
190195
191- *err = fil_io (OS_FILE_READ | wake_later
196+ *err = _fil_io (OS_FILE_READ | wake_later
192197 | ignore_nonexistent_pages,
193198 sync, space, 0 , offset, 0 , UNIV_PAGE_SIZE,
194- ((buf_block_t *) bpage)->frame , bpage);
199+ ((buf_block_t *) bpage)->frame , bpage, should_buffer );
195200 }
196201
197202 if (sync) {
@@ -345,7 +350,7 @@ buf_read_ahead_random(
345350 &err, false ,
346351 ibuf_mode | OS_AIO_SIMULATED_WAKE_LATER,
347352 space, zip_size, FALSE ,
348- tablespace_version, i);
353+ tablespace_version, i, false );
349354 if (err == DB_TABLESPACE_DELETED) {
350355 ut_print_timestamp (stderr);
351356 fprintf (stderr,
@@ -408,7 +413,7 @@ buf_read_page(
408413
409414 count = buf_read_page_low (&err, true , BUF_READ_ANY_PAGE, space,
410415 zip_size, FALSE ,
411- tablespace_version, offset);
416+ tablespace_version, offset, false );
412417 srv_stats.buf_pool_reads .add (count);
413418 if (err == DB_TABLESPACE_DELETED) {
414419 ut_print_timestamp (stderr);
@@ -456,7 +461,7 @@ buf_read_page_async(
456461 | OS_AIO_SIMULATED_WAKE_LATER
457462 | BUF_READ_IGNORE_NONEXISTENT_PAGES,
458463 space, zip_size, FALSE ,
459- tablespace_version, offset);
464+ tablespace_version, offset, false );
460465 srv_stats.buf_pool_reads .add (count);
461466
462467 /* We do not increment number of I/O operations used for LRU policy
@@ -715,7 +720,7 @@ buf_read_ahead_linear(
715720 count += buf_read_page_low (
716721 &err, false ,
717722 ibuf_mode,
718- space, zip_size, FALSE , tablespace_version, i);
723+ space, zip_size, FALSE , tablespace_version, i, true );
719724 if (err == DB_TABLESPACE_DELETED) {
720725 ut_print_timestamp (stderr);
721726 fprintf (stderr,
@@ -728,6 +733,9 @@ buf_read_ahead_linear(
728733 }
729734 }
730735 }
736+ #if defined(LINUX_NATIVE_AIO)
737+ os_aio_linux_dispatch_read_array_submit ();
738+ #endif
731739
732740 /* In simulated aio we wake the aio handler threads only after
733741 queuing all aio requests, in native aio the following call does
@@ -805,7 +813,7 @@ buf_read_ibuf_merge_pages(
805813 buf_read_page_low (&err, sync && (i + 1 == n_stored),
806814 BUF_READ_ANY_PAGE, space_ids[i],
807815 zip_size, TRUE , space_versions[i],
808- page_nos[i]);
816+ page_nos[i], false );
809817
810818 if (UNIV_UNLIKELY (err == DB_TABLESPACE_DELETED)) {
811819tablespace_deleted:
@@ -900,12 +908,12 @@ buf_read_recv_pages(
900908 if ((i + 1 == n_stored) && sync) {
901909 buf_read_page_low (&err, true , BUF_READ_ANY_PAGE, space,
902910 zip_size, TRUE , tablespace_version,
903- page_nos[i]);
911+ page_nos[i], false );
904912 } else {
905913 buf_read_page_low (&err, false , BUF_READ_ANY_PAGE
906914 | OS_AIO_SIMULATED_WAKE_LATER,
907915 space, zip_size, TRUE ,
908- tablespace_version, page_nos[i]);
916+ tablespace_version, page_nos[i], false );
909917 }
910918 }
911919
0 commit comments