Skip to content

Commit 0b8b84d

Browse files
committed
MDEV-21501 Innodb AIO: release IO slots early in io_callback
prevent potential stalls for when all slots are used up, and all io threads are used up, and io callbacks are slow.
1 parent c32fd50 commit 0b8b84d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

storage/innobase/fil/fil0fil.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4184,15 +4184,13 @@ fil_io(
41844184
/**********************************************************************/
41854185

41864186
/** Callback for AIO completion */
4187-
void fil_aio_callback(const tpool::aiocb *cb)
4187+
void fil_aio_callback(os_aio_userdata_t *data)
41884188
{
4189-
os_aio_userdata_t *data=(os_aio_userdata_t *)cb->m_userdata;
41904189
fil_node_t* node= data->node;
41914190
void* message = data->message;
41924191

41934192
ut_ad(fil_validate_skip());
41944193

4195-
ut_a(cb->m_err == DB_SUCCESS);
41964194

41974195
if (node == NULL) {
41984196
ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS);

storage/innobase/os/os0file.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3872,12 +3872,12 @@ os_file_get_status(
38723872
}
38733873

38743874

3875-
extern void fil_aio_callback(const tpool::aiocb *cb);
3875+
extern void fil_aio_callback(os_aio_userdata_t *data);
38763876

38773877
static void io_callback(tpool::aiocb* cb)
38783878
{
3879-
fil_aio_callback(cb);
3880-
3879+
ut_a(cb->m_err == DB_SUCCESS);
3880+
os_aio_userdata_t data = *(os_aio_userdata_t*)cb->m_userdata;
38813881
/* Return cb back to cache*/
38823882
if (cb->m_opcode == tpool::aio_opcode::AIO_PREAD) {
38833883
if (read_slots->contains(cb)) {
@@ -3890,6 +3890,8 @@ static void io_callback(tpool::aiocb* cb)
38903890
ut_ad(write_slots->contains(cb));
38913891
write_slots->release(cb);
38923892
}
3893+
3894+
fil_aio_callback(&data);
38933895
}
38943896

38953897
#ifdef LINUX_NATIVE_AIO

0 commit comments

Comments
 (0)