Browse Source

Fix incorrect calls to prepare_journal_sector_write() when flushing multiple sectors

Vitaliy Filippov 6 months ago
parent
commit
9ef7f865b0
  1. 7
      blockstore_rollback.cpp
  2. 7
      blockstore_stable.cpp
  3. 9
      blockstore_sync.cpp

7
blockstore_rollback.cpp

@ -86,10 +86,9 @@ skip_ov:
if ((journal_block_size - journal.in_sector_pos) < sizeof(journal_entry_rollback) &&
journal.sector_info[journal.cur_sector].dirty)
{
if (cur_sector == -1)
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
cur_sector = journal.cur_sector;
prepare_journal_sector_write(journal, cur_sector, sqe[s++], cb);
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
prepare_journal_sector_write(journal, journal.cur_sector, sqe[s++], cb);
cur_sector = ((journal.cur_sector + 1) % journal.sector_count);
}
for (i = 0, v = (obj_ver_id*)op->buf; i < op->len; i++, v++)
{

7
blockstore_stable.cpp

@ -109,10 +109,9 @@ int blockstore_impl_t::dequeue_stable(blockstore_op_t *op)
if ((journal_block_size - journal.in_sector_pos) < sizeof(journal_entry_stable) &&
journal.sector_info[journal.cur_sector].dirty)
{
if (cur_sector == -1)
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
cur_sector = journal.cur_sector;
prepare_journal_sector_write(journal, cur_sector, sqe[s++], cb);
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
prepare_journal_sector_write(journal, journal.cur_sector, sqe[s++], cb);
cur_sector = ((journal.cur_sector + 1) % journal.sector_count);
}
for (i = 0, v = (obj_ver_id*)op->buf; i < op->len; i++, v++)
{

9
blockstore_sync.cpp

@ -123,10 +123,9 @@ int blockstore_impl_t::continue_sync(blockstore_op_t *op)
if ((journal_block_size - journal.in_sector_pos) < sizeof(journal_entry_big_write) &&
journal.sector_info[journal.cur_sector].dirty)
{
if (cur_sector == -1)
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
cur_sector = journal.cur_sector;
prepare_journal_sector_write(journal, cur_sector, sqe[s++], cb);
PRIV(op)->min_flushed_journal_sector = 1 + journal.cur_sector;
prepare_journal_sector_write(journal, journal.cur_sector, sqe[s++], cb);
cur_sector = ((journal.cur_sector + 1) % journal.sector_count);
}
while (it != PRIV(op)->sync_big_writes.end())
{
@ -154,7 +153,7 @@ int blockstore_impl_t::continue_sync(blockstore_op_t *op)
it++;
if (cur_sector != journal.cur_sector)
{
// Write previous sector. We should write the sector only after filling it,
// Write the previous sector. We should write the sector only after filling it,
// because otherwise we'll write a lot more sectors in the "no_same_sector_overwrite" mode
if (cur_sector != -1)
prepare_journal_sector_write(journal, cur_sector, sqe[s++], cb);

Loading…
Cancel
Save