}
}
+void FileJournal::flush()
+{
+ write_lock.Lock();
+ while ((!writeq.empty() || writing) && !write_stop) {
+ dout(10) << "flush waiting for writeq to empty and writes to complete" << dendl;
+ write_empty_cond.Wait(write_lock);
+ }
+ write_lock.Unlock();
+ dout(10) << "flush done" << dendl;
+}
+
void FileJournal::write_thread_entry()
{
if (writeq.empty()) {
// sleep
dout(20) << "write_thread_entry going to sleep" << dendl;
+ write_empty_cond.Signal();
write_cond.Wait(write_lock);
dout(20) << "write_thread_entry woke up" << dendl;
continue;
prepare_multi_write(bl);
do_write(bl);
}
-
+ write_empty_cond.Signal();
write_lock.Unlock();
dout(10) << "write_thread_entry finish" << dendl;
}
dout(10) << "sync_and_flush" << dendl;
sync();
+ if (journal)
+ journal->flush();
+
if (g_conf.filestore_journal_writeahead) {
dout(10) << "sync_and_flush waiting for journal finisher" << dendl;
finisher.wait_for_empty();
virtual int open(__u64 last_seq) = 0;
virtual void close() = 0;
+ virtual void flush() = 0;
+
void set_wait_on_full(bool b) { wait_on_full = b; }
// writes