Fix mark_completed_lsns for enabled fsyncs
This commit is contained in:
@@ -1501,7 +1501,7 @@ void blockstore_heap_t::complete_block_write(uint32_t block_num)
|
|||||||
assert(!(it->flags & HEAP_INFLIGHT_DONE));
|
assert(!(it->flags & HEAP_INFLIGHT_DONE));
|
||||||
it->flags |= HEAP_INFLIGHT_DONE;
|
it->flags |= HEAP_INFLIGHT_DONE;
|
||||||
}
|
}
|
||||||
mark_completed_lsns();
|
mark_completed_lsns(mod_lsn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1938,7 +1938,7 @@ void blockstore_heap_t::push_inflight_lsn(uint64_t lsn, heap_entry_t *wr, uint64
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void blockstore_heap_t::mark_completed_lsns()
|
void blockstore_heap_t::mark_completed_lsns(uint64_t mod_lsn)
|
||||||
{
|
{
|
||||||
if (dsk->disable_meta_fsync && dsk->disable_journal_fsync)
|
if (dsk->disable_meta_fsync && dsk->disable_journal_fsync)
|
||||||
{
|
{
|
||||||
@@ -1956,10 +1956,11 @@ void blockstore_heap_t::mark_completed_lsns()
|
|||||||
first_inflight_lsn++;
|
first_inflight_lsn++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (mod_lsn == completed_lsn+1)
|
||||||
{
|
{
|
||||||
// Only advanced completed_lsn
|
// Only advance completed_lsn
|
||||||
for (auto it = inflight_lsn.begin(); it != inflight_lsn.end() && (it->flags & HEAP_INFLIGHT_DONE); it++)
|
assert(inflight_lsn.size() > mod_lsn-first_inflight_lsn);
|
||||||
|
for (auto it = inflight_lsn.begin()+(mod_lsn-first_inflight_lsn); it != inflight_lsn.end() && (it->flags & HEAP_INFLIGHT_DONE); it++)
|
||||||
{
|
{
|
||||||
completed_lsn++;
|
completed_lsn++;
|
||||||
}
|
}
|
||||||
@@ -1974,6 +1975,7 @@ void blockstore_heap_t::mark_lsn_fsynced(uint64_t lsn)
|
|||||||
assert(lsn <= completed_lsn);
|
assert(lsn <= completed_lsn);
|
||||||
while (lsn >= first_inflight_lsn)
|
while (lsn >= first_inflight_lsn)
|
||||||
{
|
{
|
||||||
|
assert(inflight_lsn.size() > 0);
|
||||||
apply_inflight(inflight_lsn.front());
|
apply_inflight(inflight_lsn.front());
|
||||||
inflight_lsn.pop_front();
|
inflight_lsn.pop_front();
|
||||||
first_inflight_lsn++;
|
first_inflight_lsn++;
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ class blockstore_heap_t
|
|||||||
void mark_garbage_up_to(heap_entry_t *wr);
|
void mark_garbage_up_to(heap_entry_t *wr);
|
||||||
void mark_garbage(uint32_t block_num, heap_entry_t *prev_wr, uint32_t used_big);
|
void mark_garbage(uint32_t block_num, heap_entry_t *prev_wr, uint32_t used_big);
|
||||||
void push_inflight_lsn(uint64_t lsn, heap_entry_t *wr, uint64_t flags);
|
void push_inflight_lsn(uint64_t lsn, heap_entry_t *wr, uint64_t flags);
|
||||||
void mark_completed_lsns();
|
void mark_completed_lsns(uint64_t mod_lsn);
|
||||||
void apply_inflight(heap_inflight_lsn_t & inflight);
|
void apply_inflight(heap_inflight_lsn_t & inflight);
|
||||||
public:
|
public:
|
||||||
blockstore_heap_t(blockstore_disk_t *dsk, uint8_t *buffer_area, int log_level = 0);
|
blockstore_heap_t(blockstore_disk_t *dsk, uint8_t *buffer_area, int log_level = 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user