]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: Cleanup new segment conditionals
authorSam Lang <sam.lang@inktank.com>
Thu, 21 Feb 2013 13:35:14 +0000 (07:35 -0600)
committerSam Lang <sam.lang@inktank.com>
Sat, 16 Mar 2013 16:45:36 +0000 (11:45 -0500)
The second conditional for adding a new segment is always
true when the first conditional is true.  Clean this up
to simply create a new segment when we've reached the end of
the current segment.

Signed-off-by: Sam Lang <sam.lang@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/mds/MDLog.cc

index 0fabbc633e7b0d6b3fdb50b7d79777fc680e9747..7502e6844730ebb7c2376c555a4bf962765e3197 100644 (file)
@@ -219,9 +219,8 @@ void MDLog::submit_entry(LogEvent *le, Context *c)
   //  FIXME: should this go elsewhere?
   uint64_t last_seg = get_last_segment_offset();
   uint64_t period = journaler->get_layout_period();
-  if (!segments.empty() && 
-      (journaler->get_write_pos()/period != last_seg/period &&
-       journaler->get_write_pos() - last_seg > period/2)) {
+  // start a new segment if there are none or if we reach end of last segment
+  if (journaler->get_write_pos()/period != last_seg/period) {
     dout(10) << "submit_entry also starting new segment: last = " << last_seg
             << ", cur pos = " << journaler->get_write_pos() << dendl;
     start_new_segment();