]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: align bluefs_extents to min_alloc_size
authorSage Weil <sage@redhat.com>
Fri, 8 Sep 2017 22:08:07 +0000 (18:08 -0400)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 30 Sep 2017 00:36:50 +0000 (08:36 +0800)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 0c777efdcb2ee5a6322f0eb277e681d0f086e0b6)

src/os/bluestore/BlueStore.cc

index 9c2a2fedcd24d9a2e4d7f1e5534740854bf6493c..5e77da5ed96a6b07956b7c6a595a73f212b89a38 100644 (file)
@@ -4164,13 +4164,14 @@ int BlueStore::_open_fm(bool create)
     // allocate superblock reserved space.  note that we do not mark
     // bluefs space as allocated in the freelist; we instead rely on
     // bluefs_extents.
-    fm->allocate(0, SUPER_RESERVED, t);
+    uint64_t reserved = ROUND_UP_TO(MAX(SUPER_RESERVED, min_alloc_size),
+                                   min_alloc_size);
+    fm->allocate(0, reserved, t);
 
-    uint64_t reserved = 0;
     if (cct->_conf->bluestore_bluefs) {
       assert(bluefs_extents.num_intervals() == 1);
       interval_set<uint64_t>::iterator p = bluefs_extents.begin();
-      reserved = p.get_start() + p.get_len();
+      reserved = ROUND_UP_TO(p.get_start() + p.get_len(), min_alloc_size);
       dout(20) << __func__ << " reserved 0x" << std::hex << reserved << std::dec
               << " for bluefs" << dendl;
       bufferlist bl;
@@ -4178,8 +4179,6 @@ int BlueStore::_open_fm(bool create)
       t->set(PREFIX_SUPER, "bluefs_extents", bl);
       dout(20) << __func__ << " bluefs_extents 0x" << std::hex << bluefs_extents
               << std::dec << dendl;
-    } else {
-      reserved = SUPER_RESERVED;
     }
 
     if (cct->_conf->bluestore_debug_prefill > 0) {