From: Jason Dillaman Date: Tue, 2 Jun 2015 14:32:41 +0000 (-0400) Subject: librbd: add rbd_non_blocking_aio option to image metadata X-Git-Tag: v9.0.2~71^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=008a9c4f6f8d14655f0fa452bb89c96c6e4c302e;p=ceph.git librbd: add rbd_non_blocking_aio option to image metadata Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 39ae8e7bd2d6..20a9ded3dc49 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -843,6 +843,7 @@ public: ldout(cct, 20) << __func__ << dendl; static uint64_t max_conf_items = 128; std::map configs = boost::assign::map_list_of( + "rbd_non_blocking_aio", false)( "rbd_cache", false)( "rbd_cache_writethrough_until_flush", false)( "rbd_cache_size", false)( @@ -908,6 +909,7 @@ public: config = cct->_conf->rbd_##config; \ } while (0); + ASSIGN_OPTION(non_blocking_aio); ASSIGN_OPTION(cache); ASSIGN_OPTION(cache_writethrough_until_flush); ASSIGN_OPTION(cache_size); diff --git a/src/librbd/ImageCtx.h b/src/librbd/ImageCtx.h index 16d99e67197a..3402e6d18bdc 100644 --- a/src/librbd/ImageCtx.h +++ b/src/librbd/ImageCtx.h @@ -135,6 +135,7 @@ namespace librbd { // Configuration static const string METADATA_CONF_PREFIX; + bool non_blocking_aio; bool cache; bool cache_writethrough_until_flush; uint64_t cache_size; diff --git a/src/librbd/librbd.cc b/src/librbd/librbd.cc index 8006120f8971..7d18efb5c8cc 100644 --- a/src/librbd/librbd.cc +++ b/src/librbd/librbd.cc @@ -129,7 +129,7 @@ private: void submit_aio_read(librbd::ImageCtx *ictx, uint64_t off, size_t len, char *buf, bufferlist *pbl, librbd::AioCompletion *c, int op_flags) { - if (ictx->cct->_conf->rbd_non_blocking_aio) { + if (ictx->non_blocking_aio) { ictx->aio_work_queue->queue(new C_AioReadWQ(ictx, off, len, buf, pbl, c, op_flags)); } else { @@ -139,7 +139,7 @@ void submit_aio_read(librbd::ImageCtx *ictx, uint64_t off, size_t len, void submit_aio_write(librbd::ImageCtx *ictx, uint64_t off, size_t len, const char *buf, librbd::AioCompletion *c, int op_flags) { - if (ictx->cct->_conf->rbd_non_blocking_aio) { + if (ictx->non_blocking_aio) { ictx->aio_work_queue->queue(new C_AioWriteWQ(ictx, off, len, buf, c, op_flags)); } else { @@ -149,7 +149,7 @@ void submit_aio_write(librbd::ImageCtx *ictx, uint64_t off, size_t len, void submit_aio_discard(librbd::ImageCtx *ictx, uint64_t off, uint64_t len, librbd::AioCompletion *c) { - if (ictx->cct->_conf->rbd_non_blocking_aio) { + if (ictx->non_blocking_aio) { ictx->aio_work_queue->queue(new C_AioDiscardWQ(ictx, off, len, c)); } else { librbd::aio_discard(ictx, off, len, c); @@ -157,7 +157,7 @@ void submit_aio_discard(librbd::ImageCtx *ictx, uint64_t off, uint64_t len, } void submit_aio_flush(librbd::ImageCtx *ictx, librbd::AioCompletion *c) { - if (ictx->cct->_conf->rbd_non_blocking_aio) { + if (ictx->non_blocking_aio) { ictx->aio_work_queue->queue(new C_AioFlushWQ(ictx, c)); } else { librbd::aio_flush(ictx, c);