From 0faa47e089dc5a2e86753d9788eee55711f4d547 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 31 Dec 2008 11:21:21 -0800 Subject: [PATCH] journaler: add --journaler_safe hack support back --- src/osdc/Journaler.cc | 12 +++++++----- src/osdc/Journaler.h | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/osdc/Journaler.cc b/src/osdc/Journaler.cc index c3306a6c6eac7..a978b78b5be92 100644 --- a/src/osdc/Journaler.cc +++ b/src/osdc/Journaler.cc @@ -276,7 +276,7 @@ void Journaler::_finish_flush(int r, __s64 start, utime_t stamp, bool safe) } -__s64 Journaler::append_entry(bufferlist& bl, Context *onsync) +__s64 Journaler::append_entry(bufferlist& bl) { uint32_t s = bl.length(); @@ -323,10 +323,6 @@ __s64 Journaler::append_entry(bufferlist& bl, Context *onsync) write_buf.claim_append(bl); write_pos += sizeof(s) + s; - // flush now? - if (onsync) - flush(onsync); - return write_pos; } @@ -364,6 +360,12 @@ void Journaler::_do_flush() void Journaler::wait_for_flush(Context *onsync, Context *onsafe, bool add_ack_barrier) { + if (g_conf.journaler_safe && onsync) { + assert(!onsafe); + onsafe = onsync; + onsync = 0; + } + // all flushed and acked? if (write_pos == ack_pos) { assert(write_buf.length() == 0); diff --git a/src/osdc/Journaler.h b/src/osdc/Journaler.h index ea017f6a8ebf0..9c56cdf904b03 100644 --- a/src/osdc/Journaler.h +++ b/src/osdc/Journaler.h @@ -232,7 +232,7 @@ public: __s64 get_trimmed_pos() const { return trimmed_pos; } // write - __s64 append_entry(bufferlist& bl, Context *onsync = 0); + __s64 append_entry(bufferlist& bl); void wait_for_flush(Context *onsync = 0, Context *onsafe = 0, bool add_ack_barrier=false); void flush(Context *onsync = 0, Context *onsafe = 0, bool add_ack_barrier=false); -- 2.39.5