Skip to content

Commit

Permalink
Merge pull request ceph#2091 from ceph/wip-kinetic-os
Browse files Browse the repository at this point in the history
prototype kinetic osd backend

Reviewed-by: Sage Weil <[email protected]>
  • Loading branch information
Sage Weil committed Jul 11, 2014
2 parents 49e5c8e + 59c00e5 commit 636a899
Show file tree
Hide file tree
Showing 19 changed files with 579 additions and 48 deletions.
12 changes: 12 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,18 @@ AC_LANG_POP([C++])
# Find supported SIMD / SSE extensions supported by the compiler
AX_INTEL_FEATURES()

# kinetic osd backend?
AC_ARG_WITH([kinetic],
[AS_HELP_STRING([--with-kinetic], [build kinetic support])],
[],
[with_kinetic=no])
# no pkg-config support yet
#AS_IF([test "x$with_kinetic" = "xyes"],
# [PKG_CHECK_MODULES([KINETIC], [kinetic_client], [], [true])])
AS_IF([test "x$with_kinetic" = "xyes"],
[AC_DEFINE([HAVE_KINETIC], [1], [Defined if you have kinetic enabled])])
AM_CONDITIONAL(WITH_KINETIC, [ test "$with_kinetic" = "yes" ])

# use system libs3?
AC_ARG_WITH([system-libs3],
[AS_HELP_STRING([--with-system-libs3], [use system libs3])],
Expand Down
8 changes: 8 additions & 0 deletions src/common/config_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,14 @@ OPTION(leveldb_paranoid, OPT_BOOL, false) // leveldb paranoid flag
OPTION(leveldb_log, OPT_STR, "/dev/null") // enable leveldb log file
OPTION(leveldb_compact_on_mount, OPT_BOOL, false)

OPTION(osd_keyvaluedb, OPT_STR, "leveldb")

OPTION(kinetic_host, OPT_STR, "") // hostname or ip address of a kinetic drive to use
OPTION(kinetic_port, OPT_INT, 8123) // port number of the kinetic drive
OPTION(kinetic_user_id, OPT_INT, 1) // kinetic user to authenticate as
OPTION(kinetic_hmac_key, OPT_STR, "asdfasdf") // kinetic key to authenticate with
OPTION(kinetic_use_ssl, OPT_BOOL, false) // whether to secure kinetic traffic with TLS

/**
* osd_client_op_priority and osd_recovery_op_priority adjust the relative
* priority of client io vs recovery io.
Expand Down
7 changes: 6 additions & 1 deletion src/os/FileJournal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,12 @@ FileJournal::read_entry_result FileJournal::do_read_entry(
// ok!
if (seq)
*seq = h->seq;
journalq.push_back(pair<uint64_t,off64_t>(h->seq, pos));

// works around an apparent GCC 4.8(?) compiler bug about unaligned
// bind by reference to (packed) h->seq
journalq.push_back(
pair<uint64_t,off64_t>(static_cast<uint64_t>(h->seq),
static_cast<off64_t>(pos)));

if (next_pos)
*next_pos = pos;
Expand Down
12 changes: 12 additions & 0 deletions src/os/KeyValueStore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
#include "common/sync_filesystem.h"
#include "LevelDBStore.h"

#ifdef HAVE_KINETIC
#include "KineticStore.h"
#endif

#include "common/ceph_crypto.h"
using ceph::crypto::SHA1;

Expand Down Expand Up @@ -590,6 +594,10 @@ int KeyValueStore::mkfs()
KeyValueDB *store;
if (kv_type == KV_TYPE_LEVELDB) {
store = new LevelDBStore(g_ceph_context, current_fn);
#ifdef HAVE_KINETIC
} else if (kv_type == KV_TYPE_KINETIC) {
store = new KineticStore(g_ceph_context);
#endif
} else {
derr << "KeyValueStore::mkfs error: unknown backend type" << kv_type << dendl;
ret = -1;
Expand Down Expand Up @@ -790,6 +798,10 @@ int KeyValueStore::mount()
KeyValueDB *store;
if (kv_type == KV_TYPE_LEVELDB) {
store = new LevelDBStore(g_ceph_context, current_fn);
#ifdef HAVE_KINETIC
} else if (kv_type == KV_TYPE_KINETIC) {
store = new KineticStore(g_ceph_context);
#endif
} else {
derr << "KeyValueStore::mount error: unknown backend type" << kv_type
<< dendl;
Expand Down
13 changes: 12 additions & 1 deletion src/os/KeyValueStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ using namespace std;
enum kvstore_types {
KV_TYPE_NONE = 0,
KV_TYPE_LEVELDB,
KV_TYPE_KINETIC,
KV_TYPE_OTHER
};

Expand Down Expand Up @@ -442,7 +443,17 @@ class KeyValueStore : public ObjectStore,
bool update_to=false);
~KeyValueStore();

int _detect_backend() { kv_type = KV_TYPE_LEVELDB; return 0; }
int _detect_backend() {
if (g_conf->osd_keyvaluedb == "leveldb")
kv_type = KV_TYPE_LEVELDB;
#ifdef HAVE_KINETIC
else if (g_conf->osd_keyvaluedb == "kinetic")
kv_type = KV_TYPE_KINETIC;
#endif
else
return -EINVAL;
return 0;
}
bool test_mount_in_use();
int version_stamp_is_valid(uint32_t *version);
int update_version_stamp();
Expand Down
Loading

0 comments on commit 636a899

Please sign in to comment.