]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: make librbd cache send read op with fadvise_flags. 3452/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Tue, 27 Jan 2015 01:53:39 +0000 (09:53 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Wed, 28 Jan 2015 00:48:47 +0000 (08:48 +0800)
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/librbd/AioCompletion.h
src/librbd/AioRequest.h
src/librbd/LibrbdWriteback.cc

index e4b034f3c904de7460569155c3d4f33a85e33d58..e1924d6ca47d6e9cfd4c4a4dc489fc122555a29a 100644 (file)
@@ -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;
index 4e29feb82aa6a699edcdb46de25fb672a2036877..55fab22289bed85197c1c686e985861de1fbe51b 100644 (file)
@@ -76,6 +76,11 @@ namespace librbd {
     ceph::bufferlist &data() {
       return m_read_data;
     }
+
+    int get_op_flags() {
+      return m_op_flags;
+    }
+
     std::map<uint64_t, uint64_t> m_ext_map;
 
     friend class C_AioRead;
index 854ac9dc3e78becf328652f330d560e9bedadb39..aee504c81accd1f39ca353f67312bc5a2b624e6d 100644 (file)
@@ -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<C_AioRead *>(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);