From: Yang Honggang Date: Sun, 8 Apr 2018 10:41:02 +0000 (+0000) Subject: os/kstore: fix statfs problem and add vstart.sh support X-Git-Tag: v13.1.0~277^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c201064a9aad19f8897968a35c46c378875721c5;p=ceph.git os/kstore: fix statfs problem and add vstart.sh support Fixes: http://tracker.ceph.com/issues/23590 Signed-off-by: Yang Honggang --- diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index 0ecf87a5684d..f720f8c086dc 100644 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -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; } diff --git a/src/os/kstore/KStore.h b/src/os/kstore/KStore.h index e1938bbb0bc7..2d1701611640 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -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; diff --git a/src/vstart.sh b/src/vstart.sh index 878730ae4cfd..7d72b2b31d48 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -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 : 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