]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/newstore: cap fid_max below newstore_max_dir_size
authorXiaoxi Chen <xiaoxi.chen@intel.com>
Tue, 7 Apr 2015 08:41:27 +0000 (16:41 +0800)
committerSage Weil <sage@redhat.com>
Tue, 1 Sep 2015 17:39:36 +0000 (13:39 -0400)
Prevent fid_max over the max_dir_size when preallocation.

Signed-off-by: Xiaoxi Chen <xiaoxi.chen@intel.com>
src/os/newstore/NewStore.cc

index d23a391608afa4f4df7baf2894c6f0ccb32346a0..c226f81a87d3d5ee5bb4e29fdccd936cd776f75d 100644 (file)
@@ -1870,8 +1870,8 @@ int NewStore::_create_fid(TransContext *txc, fid_t *fid)
        fid_last.fno < g_conf->newstore_max_dir_size) {
       ++fid_last.fno;
       if (fid_last.fno >= fid_max.fno) {
-       // raise fid_max, same fset
-       fid_max.fno += g_conf->newstore_fid_prealloc;
+       // raise fid_max, same fset, capping to max_dir_size
+       fid_max.fno = min(fid_max.fno + g_conf->newstore_fid_prealloc, g_conf->newstore_max_dir_size);
        assert(fid_max.fno >= fid_last.fno);
        bufferlist bl;
        ::encode(fid_max, bl);