From ef420baf1c89e711a3185bac235865605c7c3a27 Mon Sep 17 00:00:00 2001 From: Xiaoxi Chen Date: Tue, 7 Apr 2015 16:41:27 +0800 Subject: [PATCH] os/newstore: cap fid_max below newstore_max_dir_size Prevent fid_max over the max_dir_size when preallocation. Signed-off-by: Xiaoxi Chen --- src/os/newstore/NewStore.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os/newstore/NewStore.cc b/src/os/newstore/NewStore.cc index d23a391608afa..c226f81a87d3d 100644 --- a/src/os/newstore/NewStore.cc +++ b/src/os/newstore/NewStore.cc @@ -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); -- 2.39.5