Fix zero-length writes
This commit is contained in:
@@ -161,6 +161,7 @@ bool journal_flusher_co::loop()
|
||||
else if (wait_state == 24) goto resume_24;
|
||||
resume_0:
|
||||
wait_state = 0;
|
||||
wait_count = 0;
|
||||
cur_oid = {};
|
||||
res = bs->heap->get_next_compact(cur_oid);
|
||||
if (res == ENOENT && flusher->force_start > 0 && co_id == 0 &&
|
||||
|
||||
@@ -571,13 +571,12 @@ bool blockstore_heap_t::calc_checksums(heap_write_t *wr, uint8_t *data, bool set
|
||||
{
|
||||
if (!dsk->csum_block_size)
|
||||
{
|
||||
if (wr->type() != BS_HEAP_SMALL_WRITE &&
|
||||
wr->type() != BS_HEAP_INTENT_WRITE)
|
||||
// Single checksum
|
||||
uint32_t *wr_csum = wr->get_checksum(this);
|
||||
if (!wr_csum)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
// Single checksum
|
||||
uint32_t *wr_csum = wr->get_checksum(this);
|
||||
uint32_t real_csum = crc32c(0, data, wr->len);
|
||||
if (set)
|
||||
{
|
||||
@@ -1309,7 +1308,7 @@ bool blockstore_heap_t::mvcc_save_copy(heap_object_t *obj)
|
||||
add_ref = 1;
|
||||
}
|
||||
}
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE)
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE && wr->len > 0)
|
||||
{
|
||||
mvcc_buffer_refs[wr->location] += add_ref;
|
||||
}
|
||||
@@ -1331,7 +1330,7 @@ void blockstore_heap_t::mark_overwritten(uint64_t over_lsn, uint64_t inode, heap
|
||||
overwrite_ref_queue.push_back((heap_refqi_t){ .lsn = over_lsn, .inode = inode, .location = wr->location, .len = 0, .is_data = true });
|
||||
mvcc_data_refs[wr->location] += !tracking_active;
|
||||
}
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE && wr->size > 0)
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE && wr->len > 0)
|
||||
{
|
||||
overwrite_ref_queue.push_back((heap_refqi_t){ .lsn = over_lsn, .inode = inode, .location = wr->location, .len = wr->len, .is_data = false });
|
||||
mvcc_buffer_refs[wr->location] += !tracking_active;
|
||||
@@ -1393,7 +1392,7 @@ int blockstore_heap_t::update_object(uint32_t block_num, heap_object_t *obj, hea
|
||||
{
|
||||
mvcc_data_refs[wr->location]++;
|
||||
}
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE)
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE && wr->len > 0)
|
||||
{
|
||||
mvcc_buffer_refs[wr->location]++;
|
||||
}
|
||||
@@ -1760,7 +1759,7 @@ void blockstore_heap_t::free_object_space(inode_t inode, heap_write_t *from, hea
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE)
|
||||
else if (wr->type() == BS_HEAP_SMALL_WRITE && wr->len > 0)
|
||||
{
|
||||
deref_buffer(inode, wr->location, wr->len, mode != BS_HEAP_FREE_MAIN);
|
||||
}
|
||||
|
||||
@@ -228,7 +228,8 @@ process_intent:
|
||||
}
|
||||
assert(res == 0);
|
||||
PRIV(op)->lsn = wr->lsn;
|
||||
heap->use_buffer_area(op->oid.inode, loc, op->len);
|
||||
if (op->len)
|
||||
heap->use_buffer_area(op->oid.inode, loc, op->len);
|
||||
prepare_meta_block_write(op, modified_block);
|
||||
if (op->len > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user