summaryrefslogtreecommitdiff
path: root/tpool
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-03-30 08:52:05 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-03-30 08:52:05 +0300
commita4d753758fd5305853ba339a0cd57d1675d5aa8c (patch)
tree33afd8af9e7cc164744bb9a2acc8ad5cf819a0e9 /tpool
parent2885fb0ee496285b49efea7d84c6cd0a8e819319 (diff)
parent0a573e7e632f604ee58f944161889bf2abe8bc2c (diff)
downloadmariadb-git-a4d753758fd5305853ba339a0cd57d1675d5aa8c.tar.gz
Merge 10.6 into 10.7
Diffstat (limited to 'tpool')
-rw-r--r--tpool/aio_liburing.cc3
-rw-r--r--tpool/aio_linux.cc3
-rw-r--r--tpool/tpool.h12
-rw-r--r--tpool/tpool_generic.cc15
4 files changed, 14 insertions, 19 deletions
diff --git a/tpool/aio_liburing.cc b/tpool/aio_liburing.cc
index b8666482193..8192a5b7fed 100644
--- a/tpool/aio_liburing.cc
+++ b/tpool/aio_liburing.cc
@@ -161,8 +161,7 @@ private:
}
io_uring_cqe_seen(&aio->uring_, cqe);
- if (iocb->m_ret_len != iocb->m_len && !iocb->m_err)
- finish_synchronous(iocb);
+ finish_synchronous(iocb);
// If we need to resubmit the IO operation, but the ring is full,
// we will follow the same path as for any other error codes.
diff --git a/tpool/aio_linux.cc b/tpool/aio_linux.cc
index fc6e5b53e1a..5d01c588a88 100644
--- a/tpool/aio_linux.cc
+++ b/tpool/aio_linux.cc
@@ -128,8 +128,7 @@ class aio_linux final : public aio
{
iocb->m_ret_len= event.res;
iocb->m_err= 0;
- if (iocb->m_ret_len != iocb->m_len)
- finish_synchronous(iocb);
+ finish_synchronous(iocb);
}
iocb->m_internal_task.m_func= iocb->m_callback;
iocb->m_internal_task.m_arg= iocb;
diff --git a/tpool/tpool.h b/tpool/tpool.h
index 2c61c2d62b2..87a0122adce 100644
--- a/tpool/tpool.h
+++ b/tpool/tpool.h
@@ -173,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
diff --git a/tpool/tpool_generic.cc b/tpool/tpool_generic.cc
index a1b9a3ce945..5720c5b48aa 100644
--- a/tpool/tpool_generic.cc
+++ b/tpool/tpool_generic.cc
@@ -85,25 +85,12 @@ void aio::synchronous(aiocb *cb)
#endif
cb->m_ret_len = ret_len;
cb->m_err = err;
- if (!err && cb->m_ret_len != cb->m_len)
+ if (ret_len)
finish_synchronous(cb);
}
/**
- A partial read/write has occured, continue synchronously.
-*/
-void aio::finish_synchronous(aiocb *cb)
-{
- assert(cb->m_ret_len != (unsigned int) cb->m_len && !cb->m_err);
- /* 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);
-}
-
-/**
Implementation of generic threadpool.
This threadpool consists of the following components