]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
uclient: Warn on truncate_[size|seq] changes for non-file inodes.
authorGreg Farnum <gregf@hq.newdream.net>
Tue, 2 Nov 2010 16:37:04 +0000 (09:37 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Tue, 2 Nov 2010 17:09:41 +0000 (10:09 -0700)
src/client/Client.cc

index 08850fc152964a454d139da8e75f351a064f6360..61a21bdccefc0e10d7dd06e58b8d2199487fbde5 100644 (file)
@@ -372,18 +372,21 @@ void Client::update_inode_file_bits(Inode *in,
     }
   }
   if (truncate_seq >= in->truncate_seq &&
-      in->truncate_size != truncate_size &&
-      in->is_file()) {
-    dout(10) << "truncate_size " << in->truncate_size << " -> "
-            << truncate_size << dendl;
-    in->truncate_size = truncate_size;
-    in->oset.truncate_size = truncate_size;
-    if (g_conf.client_oc && prior_size) { //do actual truncation
-      vector<ObjectExtent> ls;
-      filer->file_to_extents(in->ino, &in->layout,
-                             truncate_size, prior_size - truncate_size,
-                             ls);
-      objectcacher->truncate_set(&in->oset, ls);
+      in->truncate_size != truncate_size) {
+    if (in->is_file()) {
+      dout(10) << "truncate_size " << in->truncate_size << " -> "
+              << truncate_size << dendl;
+      in->truncate_size = truncate_size;
+      in->oset.truncate_size = truncate_size;
+      if (g_conf.client_oc && prior_size) { //do actual truncation
+       vector<ObjectExtent> ls;
+       filer->file_to_extents(in->ino, &in->layout,
+                              truncate_size, prior_size - truncate_size,
+                              ls);
+       objectcacher->truncate_set(&in->oset, ls);
+      }
+    } else {
+      dout(0) << "Hmmm, truncate_seq && truncate_size changed on non-file inode!" << dendl;
     }
   }