]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Journaler: Remove the unused read_pos field.
authorGreg Farnum <gregf@hq.newdream.net>
Tue, 7 Dec 2010 19:48:08 +0000 (11:48 -0800)
committerGreg Farnum <gregf@hq.newdream.net>
Thu, 6 Jan 2011 19:12:13 +0000 (11:12 -0800)
Rename it to unused_field, fill the in-memory read_pos
from header.expire_pos, and fill unused_field with the expire_pos
for safety.
(The on-disk header pos was used to fill in read_pos, but it was
always reset to expire_pos before being used and was only ever
set at the end of replay.)

Signed-off-by: Greg Farnum <gregf@hq.newdream.net>
src/osdc/Journaler.cc
src/osdc/Journaler.h

index 4b5b68029aecfce1000030cdee33963f21f78f43..0f22c7b89754599c1efffe3a6b90d00a7b709ccb 100644 (file)
@@ -61,7 +61,6 @@ ostream& operator<<(ostream& out, Journaler::Header &h)
 {
   return out << "loghead(trim " << h.trimmed_pos
             << ", expire " << h.expire_pos
-            << ", read " << h.read_pos
             << ", write " << h.write_pos
             << ")";
 }
@@ -201,8 +200,7 @@ void Journaler::_finish_read_head(int r, bufferlist& bl)
   set_layout(&h.layout);
 
   write_pos = flush_pos = ack_pos = safe_pos = h.write_pos;
-  read_pos = requested_pos = received_pos = h.read_pos;
-  expire_pos = h.expire_pos;
+  read_pos = requested_pos = received_pos = expire_pos = h.expire_pos;
   trimmed_pos = trimming_pos = h.trimmed_pos;
 
   dout(1) << "_finish_read_head " << h << ".  probing for end of log (from " << write_pos << ")..." << dendl;
@@ -311,7 +309,7 @@ void Journaler::write_head(Context *oncommit)
   assert(state == STATE_ACTIVE);
   last_written.trimmed_pos = trimmed_pos;
   last_written.expire_pos = expire_pos;
-  last_written.read_pos = read_pos;
+  last_written.unused_field = expire_pos;
   last_written.write_pos = safe_pos;
   dout(10) << "write_head " << last_written << dendl;
   
index d51aa7c23da33128d804b93312fda1c3839251f5..2c709f695e8946d6d0065f25daf6d2f125333349 100644 (file)
  * This class stripes a serial log over objects on the store.  Four logical pointers:
  *
  *  write_pos - where we're writing new entries
- *   read_pos - where we're reading old entires
+ *   unused_field - where we're reading old entires
  * expire_pos - what is deemed "old" by user
  *   trimmed_pos - where we're expiring old items
  *
- *  trimmed_pos <= expire_pos <= read_pos <= write_pos.
+ *  trimmed_pos <= expire_pos <= unused_field <= write_pos.
  *
- * Often, read_pos <= write_pos (as with MDS log).  During recovery, write_pos is undefined
+ * Often, unused_field <= write_pos (as with MDS log).  During recovery, write_pos is undefined
  * until the end of the log is discovered.
  *
  * A "head" struct at the beginning of the log is used to store metadata at
  * regular intervals.  The basic invariants include:
  *
- *   head.read_pos   <= read_pos   -- the head may "lag", since it's updated lazily.
+ *   head.unused_field   <= unused_field   -- the head may "lag", since it's updated lazily.
  *   head.write_pos  <= write_pos
  *   head.expire_pos <= expire_pos
  *   head.trimmed_pos   <= trimmed_pos
@@ -66,13 +66,13 @@ public:
   struct Header {
     uint64_t trimmed_pos;
     uint64_t expire_pos;
-    uint64_t read_pos;
+    uint64_t unused_field;
     uint64_t write_pos;
     string magic;
     ceph_file_layout layout;
 
     Header(const char *m="") :
-      trimmed_pos(0), expire_pos(0), read_pos(0), write_pos(0),
+      trimmed_pos(0), expire_pos(0), unused_field(0), write_pos(0),
       magic(m) { }
 
     void encode(bufferlist &bl) const {
@@ -81,7 +81,7 @@ public:
       ::encode(magic, bl);
       ::encode(trimmed_pos, bl);
       ::encode(expire_pos, bl);
-      ::encode(read_pos, bl);
+      ::encode(unused_field, bl);
       ::encode(write_pos, bl);
       ::encode(layout, bl);
     }
@@ -91,7 +91,7 @@ public:
       ::decode(magic, bl);
       ::decode(trimmed_pos, bl);
       ::decode(expire_pos, bl);
-      ::decode(read_pos, bl);
+      ::decode(unused_field, bl);
       ::decode(write_pos, bl);
       ::decode(layout, bl);
     }
@@ -184,7 +184,7 @@ private:
   uint64_t read_pos;      // logical read position, where next entry starts.
   uint64_t requested_pos; // what we've requested from OSD.
   uint64_t received_pos;  // what we've received from OSD.
-  bufferlist read_buf; // read buffer.  read_pos + read_buf.length() == prefetch_pos.
+  bufferlist read_buf; // read buffer.  unused_field + read_buf.length() == prefetch_pos.
   bufferlist reading_buf; // what i'm reading into
 
   uint64_t fetch_len;     // how much to read at a time