]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
FileJournal: fix check_for_full 4450/head
authorHenry Chang <henry@bigtera.com>
Thu, 23 Apr 2015 04:23:46 +0000 (12:23 +0800)
committerHenry Chang <henry@bigtera.com>
Mon, 27 Apr 2015 15:33:37 +0000 (23:33 +0800)
The condition to test if journal is passing half full mark is
incorrect. Consider the following simplified case:

Assume header.max_size = 100 and journal has 48 bytes already.

1st write (10 bytes):
max=100, room=52, size=10  --> condition not satisfied

2nd write (4 bytes):
max=100, room=42, size=4   --> condition not satisfied

It passed the half full mark without triggering filestore commit.

Signed-off-by: Henry Chang <henry@bigtera.com>
src/os/FileJournal.cc

index c6bb6f2c0755d870f01c276783906ec3b5d77114..e629cde22802e22a55dc884f964a2d1655321079 100644 (file)
@@ -751,8 +751,8 @@ int FileJournal::check_for_full(uint64_t seq, off64_t pos, off64_t size)
           << " top " << get_top() << dendl;
 
   if (do_sync_cond) {
-    if (room < (header.max_size >> 1) &&
-       room + size > (header.max_size >> 1)) {
+    if (room >= (header.max_size >> 1) &&
+        room - size < (header.max_size >> 1)) {
       dout(10) << " passing half full mark, triggering commit" << dendl;
       do_sync_cond->SloppySignal();  // initiate a real commit so we can trim
     }