erofs-utils: lib: treat data blocks filled with 0s as a hole
authorSandeep Dhavale <dhavale@google.com>
Wed, 17 Apr 2024 23:48:44 +0000 (16:48 -0700)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Mon, 22 Apr 2024 00:39:44 +0000 (08:39 +0800)
commitd86e27a4861b79fcb2f23d96331dca681e9b4dfe
tree6d08a6d86f22d300717756fa77002bdc63f9d3b1
parent2aa7859a5a63218831d8cded536eedd71430be93
erofs-utils: lib: treat data blocks filled with 0s as a hole

Add optimization to treat data blocks filled with 0s as a hole.
Even though diskspace savings are comparable to chunk based or dedupe,
having no block assigned saves us redundant disk IOs during read.

To detect blocks filled with zeros during chunking, we insert block
filled with zeros (zerochunk) in the hashmap. If we detect a possible
dedupe, we map it to the hole so there is no physical block assigned.

Signed-off-by: Sandeep Dhavale <dhavale@google.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240417234845.2758882-1-dhavale@google.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
include/erofs/blobchunk.h
lib/blobchunk.c
mkfs/main.c