]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: require that bluefs_alloc_size be multiple of min_alloc_size
authorSage Weil <sage@redhat.com>
Fri, 8 Sep 2017 22:05:29 +0000 (18:05 -0400)
committerxie xingguo <xie.xingguo@zte.com.cn>
Sat, 30 Sep 2017 00:36:09 +0000 (08:36 +0800)
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 5b47ac59816894e983a98d3da8b5415d569c6663)

src/os/bluestore/BlueStore.cc

index 3566005cd01a76132fdbf37d97e6bb10764e80bb..d04872788dc369c43c96e7c87435ee8089fd8738 100644 (file)
@@ -4545,6 +4545,13 @@ int BlueStore::_open_db(bool create)
        bdev->get_size() * (cct->_conf->bluestore_bluefs_min_ratio +
                            cct->_conf->bluestore_bluefs_gift_ratio);
       initial = MAX(initial, cct->_conf->bluestore_bluefs_min);
+      if (cct->_conf->bluefs_alloc_size % min_alloc_size) {
+       derr << __func__ << " bluefs_alloc_size 0x" << std::hex
+            << cct->_conf->bluefs_alloc_size << " is not a multiple of "
+            << "min_alloc_size 0x" << min_alloc_size << std::dec << dendl;
+       r = -EINVAL;
+       goto free_bluefs;
+      }
       // align to bluefs's alloc_size
       initial = P2ROUNDUP(initial, cct->_conf->bluefs_alloc_size);
       // put bluefs in the middle of the device in case it is an HDD