]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: fix block device file creation
authorSage Weil <sage@redhat.com>
Fri, 5 Feb 2016 14:20:40 +0000 (09:20 -0500)
committerSage Weil <sage@redhat.com>
Fri, 5 Feb 2016 14:21:41 +0000 (09:21 -0500)
Just make a separate flag to indicate whether we create a block
file.  This lets us drop the weird touch in vstart.sh, and default
to creating a token 'block' file on --mkfs.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/config_opts.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/vstart.sh

index 4ffc73992047945a770814afc9a0e525872b218c..bd65846c30344a8fa0020f3f7a91906d7cc370c5 100644 (file)
@@ -896,10 +896,13 @@ OPTION(bluestore_bluefs_reclaim_ratio, OPT_FLOAT, .20) // how much to reclaim at
 // bluestore_block_path = spdk:55cd2e404bd73932
 OPTION(bluestore_block_path, OPT_STR, "")
 OPTION(bluestore_block_size, OPT_U64, 10 * 1024*1024*1024)  // 10gb for testing
+OPTION(bluestore_block_create, OPT_BOOL, true)
 OPTION(bluestore_block_db_path, OPT_STR, "")
 OPTION(bluestore_block_db_size, OPT_U64, 0)   // rocksdb ssts (hot/warm)
+OPTION(bluestore_block_db_create, OPT_BOOL, false)
 OPTION(bluestore_block_wal_path, OPT_STR, "")
 OPTION(bluestore_block_wal_size, OPT_U64, 96 * 1024*1024) // rocksdb wal
+OPTION(bluestore_block_wal_create, OPT_BOOL, false)
 OPTION(bluestore_max_dir_size, OPT_U32, 1000000)
 OPTION(bluestore_min_alloc_size, OPT_U32, 64*1024)
 OPTION(bluestore_onode_map_size, OPT_U32, 1024)   // onodes per collection
index af3ca6c60429981471aeb25c99f89acc6a1799d1..3d86de5c24c0ef30649d45d0b5a9f505a7a093eb 100644 (file)
@@ -1572,10 +1572,11 @@ int BlueStore::_open_collections(int *errors)
 int BlueStore::_setup_block_symlink_or_file(
   string name,
   string epath,
-  uint64_t size)
+  uint64_t size,
+  bool create)
 {
   dout(20) << __func__ << " name " << name << " path " << epath
-          << " size " << size << dendl;
+          << " size " << size << " create=" << (int)create << dendl;
   int r = 0;
   if (epath.length()) {
     if (!epath.compare(0, sizeof(SPDK_PREFIX-1), SPDK_PREFIX)) {
@@ -1610,7 +1611,10 @@ int BlueStore::_setup_block_symlink_or_file(
     }
   }
   if (size) {
-    int fd = ::openat(path_fd, name.c_str(), O_RDWR, 0644);
+    unsigned flags = O_RDWR;
+    if (create)
+      flags |= O_CREAT;
+    int fd = ::openat(path_fd, name.c_str(), flags, 0644);
     if (fd >= 0) {
       // block file is present
       struct stat st;
@@ -1703,15 +1707,18 @@ int BlueStore::mkfs()
   }
 
   r = _setup_block_symlink_or_file("block", g_conf->bluestore_block_path,
-                                  g_conf->bluestore_block_size);
+                                  g_conf->bluestore_block_size,
+                                  g_conf->bluestore_block_create);
   if (r < 0)
     goto out_close_fsid;
   r = _setup_block_symlink_or_file("block.wal", g_conf->bluestore_block_wal_path,
-                                  g_conf->bluestore_block_wal_size);
+                                  g_conf->bluestore_block_wal_size,
+                                  g_conf->bluestore_block_wal_create);
   if (r < 0)
     goto out_close_fsid;
   r = _setup_block_symlink_or_file("block.db", g_conf->bluestore_block_db_path,
-                                  g_conf->bluestore_block_db_size);
+                                  g_conf->bluestore_block_db_size,
+                                  g_conf->bluestore_block_db_create);
   if (r < 0)
     goto out_close_fsid;
 
index edb817c7c3c2487a53c4a609c10942525ed534d2..81031a7f3ead69c6425fda1a11a11a624401d515 100644 (file)
@@ -563,7 +563,8 @@ private:
   int _open_collections(int *errors=0);
   void _close_collections();
 
-  int _setup_block_symlink_or_file(string name, string path, uint64_t size);
+  int _setup_block_symlink_or_file(string name, string path, uint64_t size,
+                                  bool create);
 
   int _write_bdev_label(string path, bluestore_bdev_label_t label);
   static int _read_bdev_label(string path, bluestore_bdev_label_t *label);
index a7aba2b5c8876c311ae1655cafea68aecee60f2b..cccab8808512ca083a9d389689100d80b3aedaf8 100755 (executable)
@@ -495,8 +495,11 @@ $DAEMONOPTS
         filestore wbthrottle btrfs ios hard limit = 20
         filestore wbthrottle btrfs inodes hard limit = 30
        bluestore fsck on mount = true
+       bluestore block create = true
        bluestore block db size = 67108864
+       bluestore block db create = true
        bluestore block wal size = 134217728
+       bluestore block wal create = true
 $COSDDEBUG
 $COSDMEMSTORE
 $extra_conf
@@ -593,11 +596,6 @@ EOF
            for f in $CEPH_DEV_DIR/osd$osd/* ; do btrfs sub delete $f || true ; done || true
            mkdir -p $CEPH_DEV_DIR/osd$osd
 
-           # for bluestore
-           touch $CEPH_DEV_DIR/osd$osd/block
-           touch $CEPH_DEV_DIR/osd$osd/block.db
-           touch $CEPH_DEV_DIR/osd$osd/block.wal
-
            uuid=`uuidgen`
            echo "add osd$osd $uuid"
            $SUDO $CEPH_ADM osd create $uuid