return index->unlink(o);
}
-FileStore::FileStore(const std::string &base, const std::string &jdev, const char *name, bool do_update) :
+FileStore::FileStore(const std::string &base, const std::string &jdev, osflagbits_t flags, const char *name, bool do_update) :
JournalingObjectStore(base),
internal_name(name),
basedir(base), journalpath(jdev),
+ generic_flags(flags),
blk_size(0),
fsid_fd(-1), op_fd(-1),
basedir_fd(-1), current_fd(-1),
return ret;
}
-int FileStore::mount()
+int FileStore::mount()
{
int ret;
char buf[PATH_MAX];
::unlink(nosnapfn);
}
- {
+ if (!(generic_flags & SKIP_MOUNT_OMAP)) {
KeyValueDB * omap_store = KeyValueDB::create(g_ceph_context,
superblock.omap_backend,
omap_dir);
wbthrottle.start();
sync_thread.create();
- ret = journal_replay(initial_op_seq);
- if (ret < 0) {
- derr << "mount failed to open journal " << journalpath << ": " << cpp_strerror(ret) << dendl;
- if (ret == -ENOTTY) {
- derr << "maybe journal is not pointing to a block device and its size "
- << "wasn't configured?" << dendl;
- }
+ if (!(generic_flags & SKIP_JOURNAL_REPLAY)) {
+ ret = journal_replay(initial_op_seq);
+ if (ret < 0) {
+ derr << "mount failed to open journal " << journalpath << ": " << cpp_strerror(ret) << dendl;
+ if (ret == -ENOTTY) {
+ derr << "maybe journal is not pointing to a block device and its size "
+ << "wasn't configured?" << dendl;
+ }
- // stop sync thread
- lock.Lock();
- stop = true;
- sync_cond.Signal();
- lock.Unlock();
- sync_thread.join();
+ // stop sync thread
+ lock.Lock();
+ stop = true;
+ sync_cond.Signal();
+ lock.Unlock();
+ sync_thread.join();
- wbthrottle.stop();
+ wbthrottle.stop();
- goto close_current_fd;
+ goto close_current_fd;
+ }
}
{
op_tp.stop();
journal_stop();
+ if (!(generic_flags & SKIP_JOURNAL_REPLAY))
+ journal_write_close();
op_finisher.stop();
ondisk_finisher.stop();
private:
string internal_name; ///< internal name, used to name the perfcounter instance
string basedir, journalpath;
+ osflagbits_t generic_flags;
std::string current_fn;
std::string current_op_seq_fn;
std::string omap_dir;
bool force_clear_omap=false);
public:
- FileStore(const std::string &base, const std::string &jdev, const char *internal_name = "filestore", bool update_to=false);
+ FileStore(const std::string &base, const std::string &jdev,
+ osflagbits_t flags = 0,
+ const char *internal_name = "filestore", bool update_to=false);
~FileStore();
int _detect_fs();
{
dout(10) << "journal_stop" << dendl;
finisher.stop();
+}
+
+// A journal_replay() makes journal writeable, this closes that out.
+void JournalingObjectStore::journal_write_close()
+{
if (journal) {
journal->close();
delete journal;
protected:
void journal_start();
void journal_stop();
+ void journal_write_close();
int journal_replay(uint64_t fs_op_seq);
void _op_journal_transactions(list<ObjectStore::Transaction*>& tls, uint64_t op,
ObjectStore *ObjectStore::create(CephContext *cct,
const string& type,
const string& data,
- const string& journal)
+ const string& journal,
+ osflagbits_t flags)
{
if (type == "filestore") {
- return new FileStore(data, journal);
+ return new FileStore(data, journal, flags);
}
if (type == "memstore") {
return new MemStore(cct, data);
::encode(*attrset, bl);
}
+// Flag bits
+typedef uint32_t osflagbits_t;
+const int SKIP_JOURNAL_REPLAY = 1 << 0;
+const int SKIP_MOUNT_OMAP = 1 << 1;
+
class ObjectStore {
protected:
string path;
* @param type type of store. This is a string from the configuration file.
* @param data path (or other descriptor) for data
* @param journal path (or other descriptor) for journal (optional)
+ * @param flags which filestores should check if applicable
*/
static ObjectStore *create(CephContext *cct,
const string& type,
const string& data,
- const string& journal);
+ const string& journal,
+ osflagbits_t flag = 0);
Logger *logger;
int run_diff(std::string& a_path, std::string& a_journal,
std::string& b_path, std::string& b_journal)
{
- FileStore *a = new FileStore(a_path, a_journal, "a");
- FileStore *b = new FileStore(b_path, b_journal, "b");
+ FileStore *a = new FileStore(a_path, a_journal, 0, "a");
+ FileStore *b = new FileStore(b_path, b_journal, 0, "b");
int ret = 0;
{