From d6ee1ca17cdca7e9dcb24ebbe7f874c05455296f Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 12 Jun 2023 02:31:04 +0300 Subject: [PATCH] Use zero checksum size for zero-length writes --- src/blockstore_disk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blockstore_disk.h b/src/blockstore_disk.h index 45c285ec..5426de0e 100644 --- a/src/blockstore_disk.h +++ b/src/blockstore_disk.h @@ -51,7 +51,7 @@ struct blockstore_disk_t inline uint64_t dirty_dyn_size(uint64_t offset, uint64_t len) { // Checksums may be partial if write is not aligned with csum_block_size - return clean_entry_bitmap_size + (csum_block_size + return clean_entry_bitmap_size + (csum_block_size && len > 0 ? ((offset+len+csum_block_size-1)/csum_block_size - offset/csum_block_size) * (data_csum_type & 0xFF) : 0);