]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add reqid in MOSDOp
authorZhiqiang Wang <zhiqiang.wang@intel.com>
Wed, 27 May 2015 03:14:02 +0000 (11:14 +0800)
committerSamuel Just <sjust@redhat.com>
Tue, 18 Aug 2015 18:25:23 +0000 (11:25 -0700)
The cache tier needs to set the reqid explicitly to the original reqid
from the client when proxying the write op to the base tier.

Signed-off-by: Zhiqiang Wang <zhiqiang.wang@intel.com>
src/messages/MOSDOp.h

index 628a21cc3d9ef39ee0cfd73611f929d2478fd772..5d4ab62af37723c0dd5189242a4d4d79f9ab1010 100644 (file)
@@ -32,7 +32,7 @@ class OSD;
 
 class MOSDOp : public Message {
 
-  static const int HEAD_VERSION = 5;
+  static const int HEAD_VERSION = 6;
   static const int COMPAT_VERSION = 3;
 
 private:
@@ -56,6 +56,8 @@ private:
 
   uint64_t features;
 
+  osd_reqid_t reqid; // reqid explicitly set by sender
+
 public:
   friend class MOSDOpReply;
 
@@ -69,11 +71,17 @@ public:
     snaps = i;
   }
   void set_snap_seq(const snapid_t& s) { snap_seq = s; }
+  void set_reqid(const osd_reqid_t rid) {
+    reqid = rid;
+  }
 
   osd_reqid_t get_reqid() const {
-    return osd_reqid_t(get_orig_source(),
-                      client_inc,
-                      header.tid);
+    if (reqid != osd_reqid_t())
+      return reqid;
+    else
+      return osd_reqid_t(get_orig_source(),
+                         client_inc,
+                        header.tid);
   }
   int get_client_inc() { return client_inc; }
   ceph_tid_t get_client_tid() { return header.tid; }
@@ -263,6 +271,7 @@ struct ceph_osd_request_head {
 
       ::encode(retry_attempt, payload);
       ::encode(features, payload);
+      ::encode(reqid, payload);
     }
   }
 
@@ -310,6 +319,7 @@ struct ceph_osd_request_head {
 
       retry_attempt = -1;
       features = 0;
+      reqid = osd_reqid_t();
     } else {
       // new decode 
       ::decode(client_inc, p);
@@ -350,6 +360,11 @@ struct ceph_osd_request_head {
        ::decode(features, p);
       else
        features = 0;
+
+      if (header.version >= 6)
+       ::decode(reqid, p);
+      else
+       reqid = osd_reqid_t();
     }
 
     OSDOp::split_osd_op_vector_in_data(ops, data);