]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/Newstore: add newstore_db_path option
authorSage Weil <sage@redhat.com>
Mon, 20 Apr 2015 17:33:14 +0000 (10:33 -0700)
committerSage Weil <sage@redhat.com>
Tue, 1 Sep 2015 17:39:39 +0000 (13:39 -0400)
The load of Keyvalue DB is heavy, allow user to put
DB to a seperate(fast) device.

Signed-off-by: Xiaoxi Chen <xiaoxi.chen@intel.com>
src/common/config_opts.h
src/os/newstore/NewStore.cc
src/os/newstore/NewStore.h

index bfe7d0df6650cefd53f5cf09f80dc3c984131c84..ac913c2b0a68c955a35ba7868d6c069b5fd6bc41 100644 (file)
@@ -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")
 
index d4691f8b7f705c94944fc6b54d974bdfc9aca912..9db13d368c8fb6cd9b2eddd4d977f5443015aaa5 100644 (file)
@@ -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;
index 2563ba3d5bf4a9fdd62f42b5aeced8b95e0082c8..35b73770d63fc5c5b88194000fee04bbec66790d 100644 (file)
@@ -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