diff --git a/src/blockstore/blockstore_flush.cpp b/src/blockstore/blockstore_flush.cpp index 38c92da3..b6c3e9a7 100644 --- a/src/blockstore/blockstore_flush.cpp +++ b/src/blockstore/blockstore_flush.cpp @@ -238,14 +238,9 @@ resume_1: flusher->active_flushers++; // Scan versions to flush read_vec.clear(); - unaligned_intent = NULL; for (auto wr = begin_wr; wr != end_wr; wr = wr->next()) { bs->prepare_read(read_vec, cur_obj, wr, 0, bs->dsk.data_block_size); - if (wr->flags == (BS_HEAP_INTENT_WRITE|BS_HEAP_STABLE) && !wr->can_be_collapsed(bs->heap)) - { - unaligned_intent = wr; - } } overwrite_start = overwrite_end = 0; if (read_vec.size() > 0) @@ -262,8 +257,6 @@ resume_1: { flusher->wanting_meta_fsync++; } - // Unaligned intent checksums have to be recalculated by reading data blocks from the disk - fill_unaligned_intent_checksums(); } // Read buffered data cur_obj = NULL; @@ -430,7 +423,6 @@ void journal_flusher_co::fill_partial_checksum_blocks() { read_to_fill_incomplete = true; int out_pos = read_vec.size(); - // FIXME: Take end_wr bitmap into account here, now it's incorrect bs->prepare_disk_read(read_vec, out_pos, cur_obj, end_wr, hole_start - hole_start % bs->dsk.csum_block_size, hole_start - hole_start % bs->dsk.csum_block_size + bs->dsk.csum_block_size, hole_start - hole_start % bs->dsk.csum_block_size, hole_start - hole_start % bs->dsk.csum_block_size + bs->dsk.csum_block_size, @@ -445,23 +437,6 @@ void journal_flusher_co::fill_partial_checksum_blocks() }); } -void journal_flusher_co::fill_unaligned_intent_checksums() -{ - if (!unaligned_intent) - { - return; - } - assert(unaligned_intent->next() == end_wr); - uint32_t blk_start = unaligned_intent->offset, blk_end = unaligned_intent->offset + unaligned_intent->len; - blk_start = (blk_start / bs->dsk.csum_block_size) * bs->dsk.csum_block_size; - blk_end = ((blk_end-1) / bs->dsk.csum_block_size + 1) * bs->dsk.csum_block_size; - bs->find_holes(read_vec, blk_start, blk_end, [&](int & pos, uint32_t start, uint32_t end) - { - // FIXME: Take end_wr bitmap + unaligned_intent range into account here too - bs->prepare_disk_read(read_vec, pos, cur_obj, end_wr, start, end, start, end, COPY_BUF_SKIP_CSUM); - }); -} - void journal_flusher_co::free_buffers() { for (auto it = read_vec.begin(); it != read_vec.end(); it++) @@ -497,7 +472,8 @@ int journal_flusher_co::check_and_punch_checksums() 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*)((uint8_t*)wr->get_checksums(bs->heap) + vec.offset/bs->dsk.csum_block_size*(bs->dsk.data_csum_type & 0xFF)), + 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) { printf("Checksum mismatch in object %jx:%jx v%ju in %s area at offset 0x%jx: got %08x, expected %08x\n", diff --git a/src/blockstore/blockstore_flush.h b/src/blockstore/blockstore_flush.h index d30a4840..2317f1a9 100644 --- a/src/blockstore/blockstore_flush.h +++ b/src/blockstore/blockstore_flush.h @@ -44,7 +44,7 @@ class journal_flusher_co uint64_t compact_lsn; uint64_t cur_version; heap_object_t *cur_obj; - heap_write_t *begin_wr, *end_wr, *unaligned_intent; + heap_write_t *begin_wr, *end_wr; uint32_t modified_block; bool should_repeat; @@ -64,7 +64,6 @@ class journal_flusher_co void iterate_partial_overwrites(std::function cb); void iterate_checksum_holes(std::function cb); void fill_partial_checksum_blocks(); - void fill_unaligned_intent_checksums(); void free_buffers(); int check_and_punch_checksums(); void calc_block_checksums(); diff --git a/src/blockstore/blockstore_write.cpp b/src/blockstore/blockstore_write.cpp index 02f2b09c..8204000b 100644 --- a/src/blockstore/blockstore_write.cpp +++ b/src/blockstore/blockstore_write.cpp @@ -170,6 +170,7 @@ int blockstore_impl_t::dequeue_write(blockstore_op_t *op) (obj->get_writes()->flags != (BS_HEAP_INTENT_WRITE|BS_HEAP_STABLE) || obj->get_writes()->can_be_collapsed(heap))) && // One intent-write is allowed even with fsyncs because BIG_WRITE is always counted as fsynced + dsk.disable_meta_fsync && (obj->get_writes()->flags == (BS_HEAP_BIG_WRITE|BS_HEAP_STABLE) || obj->get_writes()->flags == (BS_HEAP_INTENT_WRITE|BS_HEAP_STABLE) && dsk.disable_data_fsync)) {