From 6bb42a0c4416d0a7ce0b608ab9ea82674d2f5aba Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 2 Nov 2013 19:29:11 -0700 Subject: [PATCH] osd: move peek_journal_fsid() into ObjectStore (from OSD) This kills the last FileJournal reference in the OSD! Signed-off-by: Sage Weil --- src/ceph_osd.cc | 2 +- src/os/FileStore.cc | 9 +++++++++ src/os/FileStore.h | 2 ++ src/os/ObjectStore.h | 5 +++++ src/osd/OSD.cc | 10 ---------- src/osd/OSD.h | 1 - 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/ceph_osd.cc b/src/ceph_osd.cc index aeb7980d9f929..fa87a811610d2 100644 --- a/src/ceph_osd.cc +++ b/src/ceph_osd.cc @@ -279,7 +279,7 @@ int main(int argc, const char **argv) if (get_journal_fsid) { uuid_d fsid; - int r = OSD::peek_journal_fsid(g_conf->osd_journal, fsid); + int r = store->peek_journal_fsid(&fsid); if (r == 0) cout << fsid << std::endl; exit(r); diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 89a55b393db7c..b96ead7fbd857 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -104,6 +104,15 @@ static CompatSet get_fs_supported_compat_set() { } +int FileStore::peek_journal_fsid(uuid_d *fsid) +{ + // make sure we don't try to use aio or direct_io (and get annoying + // error messages from failing to do so); performance implications + // should be irrelevant for this use + FileJournal j(*fsid, 0, 0, journalpath.c_str(), false, false); + return j.peek_fsid(*fsid); +} + void FileStore::FSPerfTracker::update_from_perfcounters( PerfCounters &logger) { diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 0a215253c58c6..ab7e47f6fefcf 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -103,6 +103,8 @@ public: return target_version; } + int peek_journal_fsid(uuid_d *fsid); + struct FSPerfTracker { PerfCounters::avg_tracker os_commit_latency; PerfCounters::avg_tracker os_apply_latency; diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 0392e15ab3750..bd11b1482cbb8 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -879,6 +879,11 @@ public: */ virtual uint32_t get_target_version() = 0; + /** + * check the journal uuid/fsid, without opening + */ + virtual int peek_journal_fsid(uuid_d *fsid) = 0; + /** * get ideal min value for collection_list_partial() * diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 821a3ab7eb69f..042550cd8518e 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -39,7 +39,6 @@ #include "common/version.h" #include "os/ObjectStore.h" -#include "os/FileJournal.h" #include "ReplicatedPG.h" @@ -757,15 +756,6 @@ int OSD::peek_meta(const std::string &dev, std::string& magic, return 0; } -int OSD::peek_journal_fsid(string path, uuid_d& fsid) -{ - // make sure we don't try to use aio or direct_io (and get annoying - // error messages from failing to do so); performance implications - // should be irrelevant for this use - FileJournal j(fsid, 0, 0, path.c_str(), false, false); - return j.peek_fsid(fsid); -} - #undef dout_prefix #define dout_prefix _prefix(_dout, whoami, osdmap) diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 0280e5ad219e8..4ea54fc4aa4e0 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1743,7 +1743,6 @@ private: public: static int peek_meta(const std::string &dev, string& magic, uuid_d& cluster_fsid, uuid_d& osd_fsid, int& whoami); - static int peek_journal_fsid(std::string jpath, uuid_d& fsid); // startup/shutdown -- 2.39.5