]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ObjectCacher: pass new journal tid when overwriting extent
authorJason Dillaman <dillaman@redhat.com>
Thu, 19 May 2016 18:13:46 +0000 (14:13 -0400)
committerJason Dillaman <dillaman@redhat.com>
Mon, 23 May 2016 12:33:00 +0000 (08:33 -0400)
librbd needs to ensure the new journal event has been safely
committed to disk before it can mark an overwritten journal
event as committed.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 0051316effe0b25804378975b117691d7ad08a3b)

src/librbd/LibrbdWriteback.cc
src/librbd/LibrbdWriteback.h
src/osdc/ObjectCacher.cc
src/osdc/WritebackHandler.h

index 231c9b12e6dbcfd2fca96e1dce25960f46d304a3..eaa0a820506e0c65d504225906114f1ca3181350 100644 (file)
@@ -262,21 +262,22 @@ namespace librbd {
 
   void LibrbdWriteback::overwrite_extent(const object_t& oid, uint64_t off,
                                         uint64_t len,
-                                        ceph_tid_t journal_tid) {
+                                        ceph_tid_t original_journal_tid,
+                                         ceph_tid_t new_journal_tid) {
     typedef std::vector<std::pair<uint64_t,uint64_t> > Extents;
 
     assert(m_ictx->owner_lock.is_locked());
     uint64_t object_no = oid_to_object_no(oid.name, m_ictx->object_prefix);
 
     // all IO operations are flushed prior to closing the journal
-    assert(journal_tid != 0 && m_ictx->journal != NULL);
+    assert(original_journal_tid != 0 && m_ictx->journal != NULL);
 
     Extents file_extents;
     Striper::extent_to_file(m_ictx->cct, &m_ictx->layout, object_no, off,
                            len, file_extents);
     for (Extents::iterator it = file_extents.begin();
         it != file_extents.end(); ++it) {
-      m_ictx->journal->commit_io_event_extent(journal_tid, it->first,
+      m_ictx->journal->commit_io_event_extent(original_journal_tid, it->first,
                                              it->second, 0);
     }
   }
index 018b04367a393d6266d88ae262d72a6101f788db..ef5fa75127b89b3b181a1721975b5e222abf0de3 100644 (file)
@@ -42,7 +42,8 @@ namespace librbd {
     using WritebackHandler::write;
 
     virtual void overwrite_extent(const object_t& oid, uint64_t off,
-                                 uint64_t len, ceph_tid_t journal_tid);
+                                 uint64_t len, ceph_tid_t original_journal_tid,
+                                  ceph_tid_t new_journal_tid);
 
     virtual void get_client_lock();
     virtual void put_client_lock();
index f7ae589c361101422b0132bcd21f060968df231f..800b05592e6d2693f4aca6d9c3b4123f07316289 100644 (file)
@@ -481,7 +481,7 @@ void ObjectCacher::Object::replace_journal_tid(BufferHead *bh,
   if (bh_tid != 0 && bh_tid != tid) {
     // inform journal that it should not expect a writeback from this extent
     oc->writeback_handler.overwrite_extent(get_oid(), bh->start(),
-                                          bh->length(), bh_tid);
+                                          bh->length(), bh_tid, tid);
   }
   bh->set_journal_tid(tid);
 }
index f0efd2007841cf23012247b572802a4b9a0871e4..842ae54ae5af11b2f52af56c42fd2de35b20306c 100644 (file)
@@ -37,7 +37,8 @@ class WritebackHandler {
                            ceph_tid_t journal_tid, Context *oncommit) = 0;
 
   virtual void overwrite_extent(const object_t& oid, uint64_t off, uint64_t len,
-                                ceph_tid_t journal_tid) {}
+                                ceph_tid_t original_journal_tid,
+                                ceph_tid_t new_journal_tid) {}
 
   virtual bool can_scattered_write() { return false; }
   virtual ceph_tid_t write(const object_t& oid, const object_locator_t& oloc,