]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: only do truncation process when file size goes down
authorSage Weil <sage@newdream.net>
Tue, 24 Feb 2009 19:55:23 +0000 (11:55 -0800)
committerSage Weil <sage@newdream.net>
Tue, 24 Feb 2009 19:55:23 +0000 (11:55 -0800)
For file size increase, no special action is required...

src/mds/Server.cc

index a514bcf1f60cb9d556401e3a2b4e34cbe98229ac..58c7e7bb5721be9a997175e6ebce072b47eb7359 100644 (file)
@@ -4812,7 +4812,8 @@ public:
 
     // notify any clients
     mds->locker->issue_truncate(in);
-    mds->mdcache->truncate_inode(in, mdr->ls);
+    if (in->inode.is_truncating())
+      mds->mdcache->truncate_inode(in, mdr->ls);
 
     mds->balancer->hit_inode(mdr->now, in, META_POP_IWR);   
 
@@ -4832,11 +4833,12 @@ void Server::handle_client_truncate(MDRequest *mdr)
   CInode *cur = rdlock_path_pin_ref(mdr, true);
   if (!cur) return;
 
+  dout(10) << "handle_client_truncate " << req->head.args.truncate.length << " on " << *cur << dendl;
+
   if (mdr->ref_snapid != CEPH_NOSNAP) {
     reply_request(mdr, -EINVAL);
     return;
   }
-    
 
   // xlock inode
   set<SimpleLock*> rdlocks = mdr->rdlocks;