From: Jianpeng Ma Date: Tue, 27 Jan 2015 01:53:39 +0000 (+0800) Subject: librbd: make librbd cache send read op with fadvise_flags. X-Git-Tag: v0.93~148^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F3452%2Fhead;p=ceph.git librbd: make librbd cache send read op with fadvise_flags. Signed-off-by: Jianpeng Ma --- diff --git a/src/librbd/AioCompletion.h b/src/librbd/AioCompletion.h index e4b034f3c904..e1924d6ca47d 100644 --- a/src/librbd/AioCompletion.h +++ b/src/librbd/AioCompletion.h @@ -144,6 +144,9 @@ namespace librbd { void set_req(AioRead *req) { m_req = req; } + AioRead *get_req() { + return m_req; + } private: CephContext *m_cct; AioCompletion *m_completion; diff --git a/src/librbd/AioRequest.h b/src/librbd/AioRequest.h index 4e29feb82aa6..55fab22289be 100644 --- a/src/librbd/AioRequest.h +++ b/src/librbd/AioRequest.h @@ -76,6 +76,11 @@ namespace librbd { ceph::bufferlist &data() { return m_read_data; } + + int get_op_flags() { + return m_op_flags; + } + std::map m_ext_map; friend class C_AioRead; diff --git a/src/librbd/LibrbdWriteback.cc b/src/librbd/LibrbdWriteback.cc index 854ac9dc3e78..aee504c81acc 100644 --- a/src/librbd/LibrbdWriteback.cc +++ b/src/librbd/LibrbdWriteback.cc @@ -14,6 +14,7 @@ #include "librbd/ImageCtx.h" #include "librbd/internal.h" #include "librbd/LibrbdWriteback.h" +#include "librbd/AioCompletion.h" #include "include/assert.h" @@ -101,6 +102,10 @@ namespace librbd { librados::Rados::aio_create_completion(req, context_cb, NULL); librados::ObjectReadOperation op; op.read(off, len, pbl, NULL); + { + AioRead *req = (static_cast(onfinish))->get_req(); + op.set_op_flags2((uint32_t)req->get_op_flags()); + } int flags = m_ictx->get_read_flags(snapid); int r = m_ictx->data_ctx.aio_operate(oid.name, rados_completion, &op, flags, NULL);