]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: bump file_max to powers of two
authorSage Weil <sage@newdream.net>
Tue, 8 Sep 2009 20:15:39 +0000 (13:15 -0700)
committerSage Weil <sage@newdream.net>
Tue, 8 Sep 2009 20:46:42 +0000 (13:46 -0700)
src/mds/Locker.cc

index 2ac251034a7996e6eb484930ae8fa147f90a746e..614994518bbb1040a6b25593670e0f8c58a1121e 100644 (file)
@@ -1829,6 +1829,18 @@ void Locker::kick_cap_releases(MDRequest *mdr)
   }
 }
 
+
+static __u64 calc_bounding(__u64 t)
+{
+  t |= t >> 1;
+  t |= t >> 2;
+  t |= t >> 4;
+  t |= t >> 8;
+  t |= t >> 16;
+  t |= t >> 32;
+  return t + 1;
+}
+
 /*
  * update inode based on cap flush|flushsnap|wanted.
  *  adjust max_size, if needed.
@@ -1859,7 +1871,8 @@ bool Locker::_do_cap_update(CInode *in, Capability *cap,
        change_max = true;
        new_max = ROUND_UP_TO((m->get_max_size()+1) << 1, latest->get_layout_size_increment());
       } else {
-       new_max = ROUND_UP_TO((size+1)<<1, latest->get_layout_size_increment());
+       //new_max = ROUND_UP_TO((size+1)<<1, latest->get_layout_size_increment());
+       new_max = calc_bounding(size * 2);
        if (new_max > old_max)
          change_max = true;
        else