From e3938109fe13f8ae133d9a5acce52d0bb05ce3fb Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Tue, 27 Jan 2015 09:53:39 +0800 Subject: [PATCH] librbd: make librbd cache send read op with fadvise_flags. Signed-off-by: Jianpeng Ma --- src/librbd/AioCompletion.h | 3 +++ src/librbd/AioRequest.h | 5 +++++ src/librbd/LibrbdWriteback.cc | 5 +++++ 3 files changed, 13 insertions(+) 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); -- 2.47.3