Collapse intent_writes on other write types too
This commit is contained in:
@@ -1391,12 +1391,14 @@ int blockstore_heap_t::update_object(uint32_t block_num, heap_object_t *obj, hea
|
||||
used_delta -= free_writes(first_wr, NULL);
|
||||
new_wr->next_pos = 0;
|
||||
}
|
||||
else if ((wr->flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE &&
|
||||
(first_wr->flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE)
|
||||
else if ((first_wr->flags & BS_HEAP_TYPE) == BS_HEAP_INTENT_WRITE &&
|
||||
first_wr->can_be_collapsed(this))
|
||||
{
|
||||
// FIXME: All other types of writes should also purge&merge the intent write
|
||||
auto second_wr = first_wr->next();
|
||||
second_wr->version = first_wr->version;
|
||||
second_wr->len = (first_wr->offset+first_wr->len > second_wr->offset+second_wr->len ? first_wr->offset+first_wr->len : second_wr->offset+second_wr->len);
|
||||
second_wr->offset = first_wr->offset < second_wr->offset ? first_wr->offset : second_wr->offset;
|
||||
second_wr->len -= second_wr->offset;
|
||||
bitmap_set(second_wr->get_int_bitmap(this), first_wr->offset, first_wr->len, dsk->bitmap_granularity);
|
||||
if (dsk->csum_block_size)
|
||||
{
|
||||
|
||||
@@ -1536,6 +1536,8 @@ void test_intent_write(bool csum)
|
||||
assert(obj);
|
||||
assert(count_writes(obj) == 2); // intent overwrites previous intent
|
||||
assert(obj->get_writes()->lsn == 3);
|
||||
assert(obj->get_writes()->next()->offset == 0);
|
||||
assert(obj->get_writes()->next()->len == 12288);
|
||||
|
||||
uint8_t ref_int_bitmap[dsk.clean_entry_bitmap_size];
|
||||
memset(ref_int_bitmap, 0, dsk.clean_entry_bitmap_size);
|
||||
|
||||
Reference in New Issue
Block a user