Do not increment inode statistics if the object already exists

rdma-zerocopy
Vitaliy Filippov 2021-04-04 12:32:21 +03:00
rodzic 82c1a7ec67
commit a1f2f19489
2 zmienionych plików z 24 dodań i 1 usunięć

Wyświetl plik

@ -770,6 +770,7 @@ int blockstore_init_journal::handle_journal_part(void *buf, uint64_t done_pos, u
void blockstore_init_journal::erase_dirty_object(blockstore_dirty_db_t::iterator dirty_it)
{
auto oid = dirty_it->first.oid;
bool exists = !IS_DELETE(dirty_it->second.state);
auto dirty_end = dirty_it;
dirty_end++;
while (1)
@ -788,6 +789,10 @@ void blockstore_init_journal::erase_dirty_object(blockstore_dirty_db_t::iterator
auto clean_it = bs->clean_db.find(oid);
uint64_t clean_loc = clean_it != bs->clean_db.end()
? clean_it->second.location : UINT64_MAX;
if (exists && clean_loc == UINT64_MAX)
{
bs->inode_space_stats[oid.inode] -= bs->block_size;
}
bs->erase_dirty(dirty_it, dirty_end, clean_loc);
// Remove it from the flusher's queue, too
// Otherwise it may end up referring to a small unstable write after reading the rest of the journal

Wyświetl plik

@ -193,7 +193,25 @@ void blockstore_impl_t::mark_stable(const obj_ver_id & v, bool forget_dirty)
// Allocations and deletions are counted when they're stabilized
if (IS_BIG_WRITE(dirty_it->second.state))
{
inode_space_stats[dirty_it->first.oid.inode] += block_size;
int exists = -1;
if (dirty_it != dirty_db.begin())
{
auto prev_it = dirty_it;
prev_it--;
if (prev_it->first.oid == v.oid)
{
exists = IS_DELETE(prev_it->second.state) ? 0 : 1;
}
}
if (exists == -1)
{
auto clean_it = clean_db.find(v.oid);
exists = clean_it != clean_db.end() ? 1 : 0;
}
if (!exists)
{
inode_space_stats[dirty_it->first.oid.inode] += block_size;
}
}
else if (IS_DELETE(dirty_it->second.state))
{