Fix journal dirty_start position tracking and some debug prints
Fixes two bugs found during HDD testing :-) 1) OSD crashed with "BUG: Attempt to overwrite used offset of the journal" during `fio -bs=900k -iodepth=128` test with 16 MB journal 2) OSD stalled during `fio -bs=512k -iodepth=128` test with 64 MB journalcached-reads
parent
161a23c966
commit
b7e4d0c9bf
|
@ -714,9 +714,15 @@ resume_1:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (new_trim_pos < bs->journal.used_start
|
||||||
|
? (bs->journal.dirty_start >= bs->journal.used_start || bs->journal.dirty_start < new_trim_pos)
|
||||||
|
: (bs->journal.dirty_start >= bs->journal.used_start && bs->journal.dirty_start < new_trim_pos))
|
||||||
|
{
|
||||||
|
bs->journal.dirty_start = new_trim_pos;
|
||||||
|
}
|
||||||
bs->journal.used_start = new_trim_pos;
|
bs->journal.used_start = new_trim_pos;
|
||||||
#ifdef BLOCKSTORE_DEBUG
|
#ifdef BLOCKSTORE_DEBUG
|
||||||
printf("Journal trimmed to %08lx (next_free=%08lx)\n", bs->journal.used_start, bs->journal.next_free);
|
printf("Journal trimmed to %08lx (next_free=%08lx dirty_start=%08lx)\n", bs->journal.used_start, bs->journal.next_free, bs->journal.dirty_start);
|
||||||
#endif
|
#endif
|
||||||
if (bs->journal.flush_journal && !flusher->flush_queue.size())
|
if (bs->journal.flush_journal && !flusher->flush_queue.size())
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,6 +103,7 @@ public:
|
||||||
journal_flusher_t(blockstore_impl_t *bs);
|
journal_flusher_t(blockstore_impl_t *bs);
|
||||||
~journal_flusher_t();
|
~journal_flusher_t();
|
||||||
void loop();
|
void loop();
|
||||||
|
bool is_trim_wanted() { return trim_wanted; }
|
||||||
bool is_active();
|
bool is_active();
|
||||||
void mark_trim_possible();
|
void mark_trim_possible();
|
||||||
void request_trim();
|
void request_trim();
|
||||||
|
|
|
@ -218,7 +218,7 @@ void blockstore_impl_t::erase_dirty(blockstore_dirty_db_t::iterator dirty_start,
|
||||||
auto used = --journal.used_sectors[dirty_it->second.journal_sector];
|
auto used = --journal.used_sectors[dirty_it->second.journal_sector];
|
||||||
#ifdef BLOCKSTORE_DEBUG
|
#ifdef BLOCKSTORE_DEBUG
|
||||||
printf(
|
printf(
|
||||||
"remove usage of journal offset %08lx by %lx:%lx v%lu (%d refs)\n", dirty_it->second.journal_sector,
|
"remove usage of journal offset %08lx by %lx:%lx v%lu (%lu refs)\n", dirty_it->second.journal_sector,
|
||||||
dirty_it->first.oid.inode, dirty_it->first.oid.stripe, dirty_it->first.version, used
|
dirty_it->first.oid.inode, dirty_it->first.oid.stripe, dirty_it->first.version, used
|
||||||
);
|
);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -661,8 +661,13 @@ void blockstore_impl_t::release_journal_sectors(blockstore_op_t *op)
|
||||||
uint64_t s = PRIV(op)->min_flushed_journal_sector;
|
uint64_t s = PRIV(op)->min_flushed_journal_sector;
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (s != (1+journal.cur_sector) && journal.sector_info[s-1].flush_count == 0)
|
if (!journal.sector_info[s-1].dirty && journal.sector_info[s-1].flush_count == 0)
|
||||||
{
|
{
|
||||||
|
if (s == (1+journal.cur_sector))
|
||||||
|
{
|
||||||
|
// Forcibly move to the next sector and move dirty position
|
||||||
|
journal.in_sector_pos = journal.block_size;
|
||||||
|
}
|
||||||
// We know for sure that we won't write into this sector anymore
|
// We know for sure that we won't write into this sector anymore
|
||||||
uint64_t new_ds = journal.sector_info[s-1].offset + journal.block_size;
|
uint64_t new_ds = journal.sector_info[s-1].offset + journal.block_size;
|
||||||
if (new_ds >= journal.len)
|
if (new_ds >= journal.len)
|
||||||
|
|
|
@ -82,7 +82,9 @@ wait_up()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_up 60
|
if [[ $OSD_COUNT -gt 0 ]]; then
|
||||||
|
wait_up 60
|
||||||
|
fi
|
||||||
|
|
||||||
try_reweight()
|
try_reweight()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue