From 019597e6f480bc10d14adcde2aba54a0b6021ca0 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 5 Dec 2011 09:36:54 -0800 Subject: [PATCH] filejournal: make FileJournal::open() arg slightly less weird Pass in fs_op_seq (last_committed_seq), not the next expected seq, so we can avoid subtracting and adding 1 in odd places. Signed-off-by: Sage Weil --- src/os/FileJournal.cc | 7 ++++--- src/os/FileJournal.h | 2 +- src/os/Journal.h | 2 +- src/os/JournalingObjectStore.cc | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/os/FileJournal.cc b/src/os/FileJournal.cc index 19642ddeeb3d0..6b9e47e740c6d 100644 --- a/src/os/FileJournal.cc +++ b/src/os/FileJournal.cc @@ -387,11 +387,12 @@ done: return ret; } -int FileJournal::open(uint64_t next_seq) +int FileJournal::open(uint64_t fs_op_seq) { - dout(2) << "open " << fn << " next_seq " << next_seq << dendl; + dout(2) << "open " << fn << " fs_op_seq " << fs_op_seq << dendl; - last_committed_seq = next_seq - 1; + last_committed_seq = fs_op_seq; + uint64_t next_seq = fs_op_seq + 1; int err = _open(false); if (err < 0) diff --git a/src/os/FileJournal.h b/src/os/FileJournal.h index f4e7801f6587c..218c64b5454a7 100644 --- a/src/os/FileJournal.h +++ b/src/os/FileJournal.h @@ -191,7 +191,7 @@ private: } int create(); - int open(uint64_t last_seq); + int open(uint64_t fs_op_seq); void close(); void flush(); diff --git a/src/os/Journal.h b/src/os/Journal.h index 48d8fe30ce6ab..816118e4b1aec 100644 --- a/src/os/Journal.h +++ b/src/os/Journal.h @@ -40,7 +40,7 @@ public: virtual ~Journal() { } virtual int create() = 0; - virtual int open(uint64_t last_seq) = 0; + virtual int open(uint64_t fs_op_seq) = 0; virtual void close() = 0; virtual void flush() = 0; diff --git a/src/os/JournalingObjectStore.cc b/src/os/JournalingObjectStore.cc index baaf459b971cd..8414af7c721db 100644 --- a/src/os/JournalingObjectStore.cc +++ b/src/os/JournalingObjectStore.cc @@ -45,7 +45,7 @@ int JournalingObjectStore::journal_replay(uint64_t fs_op_seq) if (!journal) return 0; - int err = journal->open(op_seq+1); + int err = journal->open(op_seq); if (err < 0) { char buf[80]; dout(3) << "journal_replay open failed with " -- 2.39.5