From: Sage Weil Date: Sat, 2 May 2015 00:21:23 +0000 (-0700) Subject: os/newstore: process multiple aio completions at a time X-Git-Tag: v9.1.0~242^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=22a6a9f7681bbbafd46c36623aea8e467bb7d593;p=ceph.git os/newstore: process multiple aio completions at a time This isn't affecting things for a slow disk, but it will matter for faster backends. Signed-off-by: Sage Weil --- diff --git a/src/os/fs/FS.h b/src/os/fs/FS.h index 4b5273242267..3ab5d67f39aa 100644 --- a/src/os/fs/FS.h +++ b/src/os/fs/FS.h @@ -109,8 +109,8 @@ public: return 0; } - int get_next_completed(int timeout_ms, aio_t **paio) { - io_event event[1]; + int get_next_completed(int timeout_ms, aio_t **paio, int max) { + io_event event[max]; struct timespec t = { timeout_ms / 1000, (timeout_ms % 1000) * 1000 * 1000 @@ -119,8 +119,10 @@ public: if (r <= 0) { return r; } - *paio = (aio_t *)event[0].obj; - return 1; + for (int i=0; inewstore_aio_poll_ms, &aio); + int max = 16; + FS::aio_t *aio[max]; + int r = aio_queue.get_next_completed(g_conf->newstore_aio_poll_ms, + aio, max); if (r < 0) { derr << __func__ << " got " << cpp_strerror(r) << dendl; } - if (r == 1) { - TransContext *txc = static_cast(aio->priv); - int left = txc->num_aio.dec(); - dout(10) << __func__ << " finished aio " << aio << " txc " << txc - << " state " << txc->get_state_name() << ", " - << left << " aios left" << dendl; - VOID_TEMP_FAILURE_RETRY(::close(aio->fd)); - if (left == 0) { - _txc_state_proc(txc); + if (r > 0) { + dout(30) << __func__ << " got " << r << " completed aios" << dendl; + for (int i = 0; i < r; ++i) { + TransContext *txc = static_cast(aio[i]->priv); + int left = txc->num_aio.dec(); + dout(10) << __func__ << " finished aio " << aio[i] << " txc " << txc + << " state " << txc->get_state_name() << ", " + << left << " aios left" << dendl; + VOID_TEMP_FAILURE_RETRY(::close(aio[i]->fd)); + if (left == 0) { + _txc_state_proc(txc); + } } } }