]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: globally unique cap flush TID
authorYan, Zheng <zyan@redhat.com>
Fri, 5 Jun 2015 11:45:05 +0000 (19:45 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 18 Aug 2015 08:49:48 +0000 (16:49 +0800)
Globally unique TID will simplify MDS code that dectects duplicated
cap flushes.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/client/Client.cc
src/client/Client.h
src/client/Inode.cc
src/client/Inode.h

index 73e4ebdb7ddebc691716b01571e22e4f5fe82c77..1fad25149c2a52d5180edc7e10c589dddac67577 100644 (file)
@@ -179,7 +179,7 @@ Client::Client(Messenger *m, MonClient *mc)
     tick_event(NULL),
     monclient(mc), messenger(m), whoami(m->get_myname().num()),
     cap_epoch_barrier(0),
-    last_tid(0), oldest_tid(0), last_flush_seq(0),
+    last_tid(0), oldest_tid(0), last_flush_seq(0), last_flush_tid(1),
     initialized(false), authenticated(false),
     mounted(false), unmounting(false),
     local_osd(-1), local_osd_epoch(0),
@@ -2923,7 +2923,7 @@ void Client::send_cap(Inode *in, MetaSession *session, Cap *cap,
   snapid_t follows = 0;
 
   if (flush) {
-    flush_tid = ++in->last_flush_tid;
+    flush_tid = ++last_flush_tid;
     in->flushing_cap_tids[flush_tid] = flush;
     follows = in->snaprealm->get_snap_context().seq;
   }
@@ -3198,7 +3198,7 @@ void Client::flush_snaps(Inode *in, bool all_again, CapSnap *again)
     
     in->auth_cap->session->flushing_capsnaps.push_back(&capsnap->flushing_item);
 
-    capsnap->flush_tid = ++in->last_flush_tid;
+    capsnap->flush_tid = ++last_flush_tid;
     MClientCaps *m = new MClientCaps(CEPH_CAP_OP_FLUSHSNAP, in->ino, in->snaprealm->ino, 0, mseq,
         cap_epoch_barrier);
     m->set_client_tid(capsnap->flush_tid);
@@ -7868,7 +7868,7 @@ int Client::_fsync(Inode *in, bool syncdataonly)
 
   if (!r) {
     if (flushed_metadata)
-      wait_sync_caps(in, in->last_flush_tid);
+      wait_sync_caps(in, last_flush_tid);
 
     ldout(cct, 10) << "ino " << in->ino << " has no uncommitted writes" << dendl;
   } else {
index f560e662b3363a11c5c003115958dcfaa138d8b7..6fa4c235b74e022b339ad5695f187cbaf740dfc9 100644 (file)
@@ -293,6 +293,7 @@ public:
   ceph_tid_t last_tid;
   ceph_tid_t oldest_tid; // oldest incomplete mds request, excluding setfilelock requests
   ceph_tid_t last_flush_seq;
+  ceph_tid_t last_flush_tid;
   map<ceph_tid_t, MetaRequest*> mds_requests;
 
   void dump_mds_requests(Formatter *f);
index 994c2971ca173c44f6f0a29fd7ed539720ae1d2f..e81ebfee13b9a7d8b939049ca5d5f161c7a6a604 100644 (file)
@@ -412,7 +412,6 @@ void Inode::dump(Formatter *f) const
   }
 
   f->dump_stream("hold_caps_until") << hold_caps_until;
-  f->dump_unsigned("last_flush_tid", last_flush_tid);
 
   if (snaprealm) {
     f->open_object_section("snaprealm");
index 975a48b00638e98fb07225748902581248f395e4..7ed4958e86adbf18fb8bdfb90eae3ca21108ec50 100644 (file)
@@ -239,7 +239,6 @@ struct Inode {
   int snap_caps, snap_cap_refs;
   utime_t hold_caps_until;
   xlist<Inode*>::item cap_item, flushing_cap_item;
-  ceph_tid_t last_flush_tid;
 
   SnapRealm *snaprealm;
   xlist<Inode*>::item snaprealm_item;
@@ -306,7 +305,7 @@ struct Inode {
       dir_hashed(false), dir_replicated(false), auth_cap(NULL),
       dirty_caps(0), flushing_caps(0), flushing_cap_seq(0), shared_gen(0), cache_gen(0),
       snap_caps(0), snap_cap_refs(0),
-      cap_item(this), flushing_cap_item(this), last_flush_tid(0),
+      cap_item(this), flushing_cap_item(this),
       snaprealm(0), snaprealm_item(this),
       oset((void *)this, newlayout->fl_pg_pool, ino),
       reported_size(0), wanted_max_size(0), requested_max_size(0),