]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/kstore: fix statfs problem and add vstart.sh support 21287/head
authorYang Honggang <yanghonggang@umcloud.com>
Sun, 8 Apr 2018 10:41:02 +0000 (10:41 +0000)
committerYang Honggang <yanghonggang@umcloud.com>
Sun, 8 Apr 2018 11:35:05 +0000 (11:35 +0000)
Fixes: http://tracker.ceph.com/issues/23590
Signed-off-by: Yang Honggang <yanghonggang@umcloud.com>
src/os/kstore/KStore.cc
src/os/kstore/KStore.h
src/vstart.sh

index 0ecf87a5684d28cf1240146dd18758b87ee8657e..f720f8c086dc9e47e492cd515addd397b3db570d 100644 (file)
@@ -640,6 +640,7 @@ KStore::OnodeRef KStore::Collection::get_onode(
 KStore::KStore(CephContext *cct, const string& path)
   : ObjectStore(cct, path),
     db(NULL),
+    basedir(path),
     path_fd(-1),
     fsid_fd(-1),
     mounted(false),
@@ -1078,9 +1079,20 @@ void KStore::_sync()
   dout(10) << __func__ << " done" << dendl;
 }
 
-int KStore::statfs(struct store_statfs_t* buf)
+int KStore::statfs(struct store_statfs_t* buf0)
 {
-  return db->get_statfs(buf);
+  struct statfs buf;
+  buf0->reset();
+  if (::statfs(basedir.c_str(), &buf) < 0) {
+    int r = -errno;
+    assert(r != -ENOENT);
+    return r;
+  }
+
+  buf0->total = buf.f_blocks * buf.f_bsize;
+  buf0->available = buf.f_bavail * buf.f_bsize;
+
+  return 0;
 }
 
 
index e1938bbb0bc7fec5c0a03594a2fdc0926d40980c..2d17016116408e3087138cc11d9baf43c2773c93 100644 (file)
@@ -310,6 +310,7 @@ public:
 private:
   KeyValueDB *db;
   uuid_d fsid;
+  string basedir;
   int path_fd;  ///< open handle to $path
   int fsid_fd;  ///< open handle (locked) to $path/fsid
   bool mounted;
index 878730ae4cfd52ae331e9918796cd9a1496c736d..7d72b2b31d488be9b0445e3c83f20f5602d8c9f4 100755 (executable)
@@ -137,6 +137,7 @@ if [[ "$(get_cmake_variable WITH_MGR_DASHBOARD_FRONTEND)" != "ON" ]]; then
 fi
 
 filestore_path=
+kstore_path=
 
 VSTART_SEC="client.vstart.sh"
 
@@ -172,6 +173,7 @@ usage=$usage"\t--rgw_frontend specify the rgw frontend configuration\n"
 usage=$usage"\t--rgw_compression specify the rgw compression plugin\n"
 usage=$usage"\t-b, --bluestore use bluestore as the osd objectstore backend (default)\n"
 usage=$usage"\t-f, --filestore use filestore as the osd objectstore backend\n"
+usage=$usage"\t-K, --kstore use kstore as the osd objectstore backend\n"
 usage=$usage"\t--memstore use memstore as the osd objectstore backend\n"
 usage=$usage"\t--cache <pool>: enable cache tiering on pool\n"
 usage=$usage"\t--short: short object names only; necessary for ext4 dev\n"
@@ -264,6 +266,10 @@ case $1 in
             rgw_compression=$2
             shift
             ;;
+    --kstore_path )
+       kstore_path=$2
+       shift
+       ;;
     --filestore_path )
        filestore_path=$2
        shift
@@ -295,6 +301,9 @@ case $1 in
     -f | --filestore )
            objectstore="filestore"
            ;;
+    -K | --kstore )
+            objectstore="kstore"
+            ;;
     --hitset )
            hitset="$hitset $2 $3"
            shift
@@ -515,6 +524,9 @@ $DAEMONOPTS
        bluestore block wal path = $CEPH_DEV_DIR/osd\$id/block.wal.file
         bluestore block wal size = 1048576000
         bluestore block wal create = true
+
+        ; kstore
+        kstore fsck on mount = true
         osd objectstore = $objectstore
 $COSDSHORT
 $extra_conf
@@ -621,6 +633,8 @@ EOF
             fi
            if [ -n "$filestore_path" ]; then
                ln -s $filestore_path $CEPH_DEV_DIR/osd$osd
+           elif [ -n "$kstore_path" ]; then
+               ln -s $kstore_path $CEPH_DEV_DIR/osd$osd
            else
                mkdir -p $CEPH_DEV_DIR/osd$osd
            fi