Browse Source

Force start when journal is full

blocking-uring-test
Vitaliy Filippov 3 years ago
parent
commit
fd13965b90
  1. 13
      blockstore_flush.cpp
  2. 2
      blockstore_flush.h
  3. 1
      blockstore_journal.cpp

13
blockstore_flush.cpp

@ -53,14 +53,14 @@ journal_flusher_t::~journal_flusher_t()
bool journal_flusher_t::is_active()
{
return active_flushers > 0 || flush_queue.size() >= sync_threshold;
return active_flushers > 0 || start_forced && flush_queue.size() > 0 || flush_queue.size() >= sync_threshold;
}
void journal_flusher_t::loop()
{
for (int i = 0; i < flusher_count; i++)
{
if (!active_flushers && flush_queue.size() < sync_threshold)
if (!active_flushers && (start_forced ? !flush_queue.size() : (flush_queue.size() < sync_threshold)))
{
return;
}
@ -98,6 +98,12 @@ void journal_flusher_t::unshift_flush(obj_ver_id ov)
}
}
void journal_flusher_t::force_start()
{
start_forced = true;
bs->ringloop->wakeup(bs->ring_consumer);
}
#define await_sqe(label) \
resume_##label:\
sqe = bs->get_sqe();\
@ -148,8 +154,9 @@ bool journal_flusher_co::loop()
goto resume_18;
resume_0:
if (!flusher->flush_queue.size() ||
!flusher->active_flushers && flusher->flush_queue.size() < flusher->sync_threshold)
!flusher->start_forced && !flusher->active_flushers && flusher->flush_queue.size() < flusher->sync_threshold)
{
flusher->start_forced = false;
wait_state = 0;
return true;
}

2
blockstore_flush.h

@ -60,6 +60,7 @@ public:
// Journal flusher itself
class journal_flusher_t
{
bool start_forced = false;
int flusher_count;
int sync_threshold;
journal_flusher_co *co;
@ -81,6 +82,7 @@ public:
~journal_flusher_t();
void loop();
bool is_active();
void force_start();
void enqueue_flush(obj_ver_id oid);
void unshift_flush(obj_ver_id oid);
};

1
blockstore_journal.cpp

@ -57,6 +57,7 @@ int blockstore_journal_check_t::check_available(blockstore_operation *op, int re
{
// No space in the journal. Wait until used_start changes.
op->wait_for = WAIT_JOURNAL;
bs->flusher->force_start();
op->wait_detail = bs->journal.used_start;
return 0;
}

Loading…
Cancel
Save