]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: include oldest pending caps flushing in cap message
authorYan, Zheng <zyan@redhat.com>
Fri, 5 Jun 2015 06:34:35 +0000 (14:34 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 18 Aug 2015 08:49:50 +0000 (16:49 +0800)
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/client/Client.cc
src/messages/MClientCaps.h

index d6014c84db487f98b09289ff59833d2ce0f5902c..28b9fb09979be6e265b29c44b2d25d562a0605b9 100644 (file)
@@ -2971,6 +2971,10 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap,
     in->requested_max_size = in->wanted_max_size;
     ldout(cct, 15) << "auth cap, setting max_size = " << in->requested_max_size << dendl;
   }
+
+  if (!session->flushing_caps_tids.empty())
+    m->set_oldest_flush_tid(*session->flushing_caps_tids.begin());
+
   session->con->send_message(m);
 }
 
index 91ffdf52ffdbfff112b6b175d778241627c18934..609495bb80c1db856c3af1959f4c573772f83b91 100644 (file)
@@ -20,7 +20,7 @@
 
 
 class MClientCaps : public Message {
-  static const int HEAD_VERSION = 5;
+  static const int HEAD_VERSION = 6;
   static const int COMPAT_VERSION = 1;
 
  public:
@@ -34,6 +34,7 @@ class MClientCaps : public Message {
 
   // Receivers may not use their new caps until they have this OSD map
   epoch_t osd_epoch_barrier;
+  ceph_tid_t oldest_flush_tid;
 
   int      get_caps() { return head.caps; }
   int      get_wanted() { return head.wanted; }
@@ -86,9 +87,12 @@ class MClientCaps : public Message {
     peer.flags = flags;
   }
 
+  void set_oldest_flush_tid(ceph_tid_t tid) { oldest_flush_tid = tid; }
+  ceph_tid_t get_oldest_flush_tid() { return oldest_flush_tid; }
+
   MClientCaps()
     : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION),
-      osd_epoch_barrier(0) {
+      osd_epoch_barrier(0), oldest_flush_tid(0) {
     inline_version = 0;
   }
   MClientCaps(int op,
@@ -102,7 +106,7 @@ class MClientCaps : public Message {
              int mseq,
               epoch_t oeb)
     : Message(CEPH_MSG_CLIENT_CAPS, HEAD_VERSION, COMPAT_VERSION),
-      osd_epoch_barrier(oeb) {
+      osd_epoch_barrier(oeb), oldest_flush_tid(0) {
     memset(&head, 0, sizeof(head));
     head.op = op;
     head.ino = ino;
@@ -192,6 +196,9 @@ public:
     if (header.version >= 5) {
       ::decode(osd_epoch_barrier, p);
     }
+    if (header.version >= 6) {
+      ::decode(oldest_flush_tid, p);
+    }
   }
   void encode_payload(uint64_t features) {
     header.version = HEAD_VERSION;
@@ -232,6 +239,7 @@ public:
     }
 
     ::encode(osd_epoch_barrier, payload);
+    ::encode(oldest_flush_tid, payload);
   }
 };