From: Sage Weil Date: Mon, 20 Apr 2015 17:33:14 +0000 (-0700) Subject: os/Newstore: add newstore_db_path option X-Git-Tag: v9.1.0~242^2~56 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ba0d8d7fddd46ec7ef18336e9f7ce4c9b6c60579;p=ceph.git os/Newstore: add newstore_db_path option The load of Keyvalue DB is heavy, allow user to put DB to a seperate(fast) device. Signed-off-by: Xiaoxi Chen --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index bfe7d0df6650..ac913c2b0a68 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -809,6 +809,7 @@ OPTION(newstore_overlay_max_length, OPT_INT, 65536) OPTION(newstore_overlay_max, OPT_INT, 32) OPTION(newstore_open_by_handle, OPT_BOOL, true) OPTION(newstore_o_direct, OPT_BOOL, true) +OPTION(newstore_db_path, OPT_STR, "") OPTION(filestore_omap_backend, OPT_STR, "leveldb") diff --git a/src/os/newstore/NewStore.cc b/src/os/newstore/NewStore.cc index d4691f8b7f70..9db13d368c8f 100644 --- a/src/os/newstore/NewStore.cc +++ b/src/os/newstore/NewStore.cc @@ -569,6 +569,7 @@ NewStore::NewStore(CephContext *cct, const string& path) cct(cct), db(NULL), fs(NULL), + db_path(cct->_conf->newstore_db_path), path_fd(-1), fsid_fd(-1), frag_fd(-1), @@ -895,6 +896,11 @@ int NewStore::mkfs() if (r < 0) goto out_close_fsid; + if (db_path != "") { + r = symlinkat(db_path.c_str(), path_fd, "db"); + if (r < 0) + goto out_close_frag; + } r = _open_db(); if (r < 0) goto out_close_frag; diff --git a/src/os/newstore/NewStore.h b/src/os/newstore/NewStore.h index 2563ba3d5bf4..35b73770d63f 100644 --- a/src/os/newstore/NewStore.h +++ b/src/os/newstore/NewStore.h @@ -452,6 +452,7 @@ private: KeyValueDB *db; FS *fs; uuid_d fsid; + string db_path; int path_fd; ///< open handle to $path int fsid_fd; ///< open handle (locked) to $path/fsid int frag_fd; ///< open handle to $path/fragments