Do not use wr_offset
This commit is contained in:
@@ -409,7 +409,10 @@ int journal_flusher_co::check_and_punch_checksums()
|
||||
auto & vec = read_vec[i];
|
||||
if (!(vec.copy_flags & (COPY_BUF_COALESCED|COPY_BUF_ZERO)))
|
||||
{
|
||||
heap_write_t *wr = (heap_write_t*)((uint8_t*)cur_obj + vec.wr_offset);
|
||||
heap_write_t *wr = cur_obj->get_writes();
|
||||
while (wr && wr->lsn != vec.wr_lsn)
|
||||
wr = wr->next();
|
||||
assert(wr);
|
||||
bs->heap->calc_block_checksums(
|
||||
(uint32_t*)wr->get_checksums(bs->heap), vec.buf, wr->get_int_bitmap(bs->heap), vec.offset, vec.offset+vec.len, false,
|
||||
[&](uint32_t mismatch_pos, uint32_t expected_csum, uint32_t real_csum)
|
||||
@@ -434,7 +437,7 @@ int journal_flusher_co::check_and_punch_checksums()
|
||||
// Nothing to do
|
||||
return 0;
|
||||
}
|
||||
cur_obj = bs->heap->read_entry(cur_oid, &modified_block);
|
||||
cur_obj = bs->heap->read_entry(cur_oid, &modified_block, true);
|
||||
if (!cur_obj)
|
||||
{
|
||||
// Object is deleted, abort compaction
|
||||
@@ -498,10 +501,13 @@ void journal_flusher_co::calc_block_checksums()
|
||||
auto len = it->len;
|
||||
while ((block_done+len) >= bs->dsk.csum_block_size)
|
||||
{
|
||||
if (!block_done && it->wr_offset)
|
||||
if (!block_done && it->wr_lsn)
|
||||
{
|
||||
// We may take existing checksums if an overwrite contains a full block
|
||||
heap_write_t *wr = (heap_write_t*)((uint8_t*)cur_obj + it->wr_offset);
|
||||
heap_write_t *wr = cur_obj->get_writes();
|
||||
while (wr && wr->lsn != it->wr_lsn)
|
||||
wr = wr->next();
|
||||
assert(wr);
|
||||
assert(!(it->offset % bs->dsk.csum_block_size));
|
||||
assert(!(wr->offset % bs->dsk.csum_block_size));
|
||||
auto full_csum_offset = (it->offset - wr->offset) / bs->dsk.csum_block_size;
|
||||
|
||||
@@ -6,7 +6,7 @@ struct copy_buffer_t
|
||||
int copy_flags;
|
||||
uint64_t offset, len, disk_offset, disk_len;
|
||||
uint8_t *buf;
|
||||
uint32_t wr_offset;
|
||||
uint64_t wr_lsn;
|
||||
};
|
||||
|
||||
struct meta_sector_t
|
||||
|
||||
@@ -194,7 +194,7 @@ uint32_t blockstore_impl_t::prepare_read_simple(std::vector<copy_buffer_t> & rea
|
||||
.disk_offset = wr->location + start - wr->offset,
|
||||
.disk_len = end-start,
|
||||
.buf = buffer_area + wr->location + start - wr->offset,
|
||||
.wr_offset = (uint32_t)((uint8_t*)wr - (uint8_t*)obj),
|
||||
.wr_lsn = wr->lsn,
|
||||
});
|
||||
}
|
||||
else if (dsk.csum_block_size <= dsk.bitmap_granularity)
|
||||
@@ -243,7 +243,7 @@ void blockstore_impl_t::prepare_disk_read(std::vector<copy_buffer_t> & read_vec,
|
||||
.len = end-start,
|
||||
.disk_offset = wr->location + blk_start - wr->offset,
|
||||
.disk_len = blk_end - blk_start,
|
||||
.wr_offset = (uint32_t)((uint8_t*)wr - (uint8_t*)obj),
|
||||
.wr_lsn = wr->lsn,
|
||||
};
|
||||
if (blk_start != start || blk_end != end)
|
||||
{
|
||||
@@ -330,7 +330,10 @@ bool blockstore_impl_t::verify_read_checksums(blockstore_op_t *op)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
heap_write_t *wr = (heap_write_t*)((uint8_t*)obj + vec.wr_offset);
|
||||
heap_write_t *wr = obj->get_writes();
|
||||
while (wr && wr->lsn != vec.wr_lsn)
|
||||
wr = wr->next();
|
||||
assert(wr);
|
||||
uint32_t blk_start = vec.offset, blk_end = vec.offset + vec.len;
|
||||
if (vec.copy_flags & COPY_BUF_PADDED)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user