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>
<< " 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
}