Use clean_entry_bitmap_size instead of entry_attr_size back because of changed bitmap handling

This commit is contained in:
Vitaliy Filippov
2021-04-10 17:44:12 +03:00
parent d0c2e31312
commit ab39ce2bbb
14 changed files with 54 additions and 64 deletions
+10 -10
View File
@@ -98,9 +98,9 @@ void blockstore_init_meta::handle_entries(void* entries, unsigned count, int blo
for (unsigned i = 0; i < count; i++)
{
clean_disk_entry *entry = (clean_disk_entry*)(entries + i*bs->clean_entry_size);
if (!bs->inmemory_meta && (bs->clean_entry_bitmap_size || bs->entry_attr_size))
if (!bs->inmemory_meta && bs->clean_entry_bitmap_size)
{
memcpy(bs->clean_bitmap + (done_cnt+i)*(bs->clean_entry_bitmap_size + bs->entry_attr_size), &entry->bitmap, (bs->clean_entry_bitmap_size + bs->entry_attr_size));
memcpy(bs->clean_bitmap + (done_cnt+i)*2*bs->clean_entry_bitmap_size, &entry->bitmap, 2*bs->clean_entry_bitmap_size);
}
if (entry->oid.inode > 0)
{
@@ -550,9 +550,9 @@ int blockstore_init_journal::handle_journal_part(void *buf, uint64_t done_pos, u
.version = je->small_write.version,
};
void *bmp = (void*)je + sizeof(journal_entry_small_write);
if (bs->entry_attr_size <= sizeof(void*))
if (bs->clean_entry_bitmap_size <= sizeof(void*))
{
memcpy(&bmp, bmp, bs->entry_attr_size);
memcpy(&bmp, bmp, bs->clean_entry_bitmap_size);
}
else if (!bs->journal.inmemory)
{
@@ -560,8 +560,8 @@ int blockstore_init_journal::handle_journal_part(void *buf, uint64_t done_pos, u
// will result in a lot of small allocations for entry bitmaps. This can
// only be fixed by using a patched map with dynamic entry size, but not
// the btree_map, because it doesn't keep iterators valid all the time.
void *bmp_cp = malloc_or_die(bs->entry_attr_size);
memcpy(bmp_cp, bmp, bs->entry_attr_size);
void *bmp_cp = malloc_or_die(bs->clean_entry_bitmap_size);
memcpy(bmp_cp, bmp, bs->clean_entry_bitmap_size);
bmp = bmp_cp;
}
bs->dirty_db.emplace(ov, (dirty_entry){
@@ -630,9 +630,9 @@ int blockstore_init_journal::handle_journal_part(void *buf, uint64_t done_pos, u
.version = je->big_write.version,
};
void *bmp = (void*)je + sizeof(journal_entry_big_write);
if (bs->entry_attr_size <= sizeof(void*))
if (bs->clean_entry_bitmap_size <= sizeof(void*))
{
memcpy(&bmp, bmp, bs->entry_attr_size);
memcpy(&bmp, bmp, bs->clean_entry_bitmap_size);
}
else if (!bs->journal.inmemory)
{
@@ -640,8 +640,8 @@ int blockstore_init_journal::handle_journal_part(void *buf, uint64_t done_pos, u
// will result in a lot of small allocations for entry bitmaps. This can
// only be fixed by using a patched map with dynamic entry size, but not
// the btree_map, because it doesn't keep iterators valid all the time.
void *bmp_cp = malloc_or_die(bs->entry_attr_size);
memcpy(bmp_cp, bmp, bs->entry_attr_size);
void *bmp_cp = malloc_or_die(bs->clean_entry_bitmap_size);
memcpy(bmp_cp, bmp, bs->clean_entry_bitmap_size);
bmp = bmp_cp;
}
auto dirty_it = bs->dirty_db.emplace(ov, (dirty_entry){