]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
uClient: move last_flush_tid into Inodes,
authorGreg Farnum <gregf@hq.newdream.net>
Tue, 11 Aug 2009 17:44:39 +0000 (10:44 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Wed, 12 Aug 2009 20:33:24 +0000 (13:33 -0700)
make kick_flushing_caps faster by overwriting tids.

src/client/Client.cc
src/client/Client.h

index d83008bf8409f4337cf8c6f61479bdaea212e856..97e816e62f22eff861e9cb89137f0c52ff8fb64d 100644 (file)
@@ -120,7 +120,6 @@ Client::Client(Messenger *m, MonClient *mc) : timer(client_lock), client_lock("C
 
   last_tid = 0;
   last_flush_seq = 0;
-  last_flush_tid = 0;
 
   unsafe_sync_write = 0;
 
@@ -1606,7 +1605,7 @@ void Client::check_caps(Inode *in, bool is_delayed)
       }
       in->flushing_caps |= flush;
       in->dirty_caps = 0;
-      flush_tid = ++last_flush_tid;
+      flush_tid = ++in->last_flush_tid;
       //set the tid for each cap we're flushing
       for (int i = 0; i < CEPH_CAP_BITS; ++i) {
        if (flush & (1<<i))
@@ -1708,7 +1707,7 @@ void Client::flush_snaps(Inode *in)
             << " on " << *in << dendl;
     if (p->second.dirty_data || p->second.writing)
       continue;
-    p->second.flush_tid = ++last_flush_tid;
+    p->second.flush_tid = ++in->last_flush_tid;
     MClientCaps *m = new MClientCaps(CEPH_CAP_OP_FLUSHSNAP, in->ino, in->snaprealm->ino, 0, mseq);
     m->set_client_tid(p->second.flush_tid);
     m->head.snap_follows = p->first;
@@ -1985,23 +1984,19 @@ void Client::kick_flushing_caps(int mds)
     dout(20) << " reflushing caps on " << *in << " to mds" << mds << dendl;
     InodeCap *cap = in->auth_cap;
     assert(cap->session == session);
-    //ugh, it's a lot of comparisons to push the caps on same tid out together
-    int flush_now;
-    int already_flushed = 0;
-    for (int i=0; i<CEPH_CAP_BITS; ++i) {
-      if ((in->flushing_caps & 1<<i) &&
-         !(already_flushed & 1<<i)) {
-       flush_now = 0;
-       flush_now |= 1<<i;
-       for (int j=i+1; j<CEPH_CAP_BITS; ++j) {
-         if ((in->flushing_caps & 1<<j) &&
-             ( in->flushing_cap_tid[j] == in->flushing_cap_tid[i]))
-           flush_now |= 1<<j;
+    //if the inode is flushing caps, pick a new tid,
+    //set all the cap acks to that tid, and send off
+    //a message saying so to the new MDS.
+    if (in->flushing_caps) {
+      tid_t new_flush_tid = ++in->last_flush_tid;
+      for (int i=0; i<CEPH_CAP_BITS; ++i) {
+       if ((in->flushing_caps & 1<<i)) {
+         in->flushing_cap_tid[i] = new_flush_tid;
        }
-       send_cap(in, mds, cap, in->caps_used(), in->caps_wanted(), 
-                cap->issued | cap->implemented,
-                flush_now, in->flushing_cap_tid[i]);
       }
+      send_cap(in, mds, cap, in->caps_used(), in->caps_wanted(), 
+              cap->issued | cap->implemented,
+              in->flushing_caps, new_flush_tid);
     }
   }
 }
index 240151cdeb80ee32bb821b98a5c4aa77ff7137fc..deb9be398d8fbcf4d7cf533c60647051b6097d46 100644 (file)
@@ -322,6 +322,7 @@ class Inode {
   ceph_seq_t exporting_mseq;
   utime_t hold_caps_until;
   xlist<Inode*>::item cap_item, flushing_cap_item;
+  tid_t last_flush_tid;
 
   SnapRealm *snaprealm;
   xlist<Inode*>::item snaprealm_item;
@@ -406,7 +407,7 @@ class Inode {
     dirty_caps(0), flushing_caps(0), flushing_cap_seq(0), shared_gen(0), cache_gen(0),
     snap_caps(0), snap_cap_refs(0),
     exporting_issued(0), exporting_mds(-1), exporting_mseq(0),
-    cap_item(this), flushing_cap_item(this),
+    cap_item(this), flushing_cap_item(this), last_flush_tid(0),
     snaprealm(0), snaprealm_item(this), snapdir_parent(0),
     reported_size(0), wanted_max_size(0), requested_max_size(0),
     ref(0), ll_ref(0), 
@@ -729,7 +730,7 @@ public:
 
   // mds requests
 
-  tid_t last_tid, last_flush_seq, last_flush_tid;
+  tid_t last_tid, last_flush_seq;
   map<tid_t, MetaRequest*> mds_requests;
   set<int>                 failed_mds;