[PATCH v1] erofs-utils: mkfs: Implement 'dsunit' alignment on blobdev
Friendy.Su at sony.com
Friendy.Su at sony.com
Wed Aug 20 19:38:12 AEST 2025
Hi, Gao,
> What's your `--chunksize` ? consider the following:
chunksize = 4096
dsunit = 512 = 2M
> and two inodes:
> inode A (8k) 2M, 2M+4k
> inode B (12k) 4M, 2M, 4M+4k, 4M+8k?
> Is it possible? what's the expected behavior of
> this case.
Yes. This is the expected behavior. See runtime below:
1. Created duplicated chunk:
root at localhost:~# dd if=A-8k of=B-12k seek=1 bs=4k count=1 conv=notrunc
inode A-8k (A-chunk#1, A-chunk#2)
inode B-12k (B-chunk#1, B-chunk#2(=A-chunk#1), B-chunk#3)
2. mkfs.erofs:
root at localhost:~# ./install/usr/local/bin/mkfs.erofs -d 7 --blobdev /dev/sdb1 --dsunit 512 --chunksize 4096 -Enoinline_data /dev/sdb2 dir/
mkfs.erofs 1.8.10-g08df294b
<I> erofs_io: successfully to open /dev/sdb2
c_version: [1.8.10-g08df294b]
c_dbg_lvl: [ 7]
c_dry_run: [ 0]
<D> erofs: file /root/dir/A-8k added (type 1)
<D> erofs: file /root/dir/B-12k added (type 1)
<D> erofs: Inline tail-end data (60 bytes) to /root/dir
<I> erofs: file / dumped (mode 40755)
<D> erofs: Try to round up 0x0 to align on 512 blocks (dsunit)
<D> erofs: Aligned on 0x0
<D> erofs: Writing chunk (4096 bytes) to 0 <--- A-chunk#1
<D> erofs: Writing chunk (4096 bytes) to 1 <--- A-chunk#2
<I> erofs: file /A-8k dumped (mode 100644)
<D> erofs: Try to round up 0x2000 to align on 512 blocks (dsunit)
<D> erofs: Aligned on 0x200000 <--- Align on dsunit 2M
<D> erofs: Writing chunk (4096 bytes) to 512 <--- B-chunk#1
<D> erofs: Found duplicated chunk at 0 <--- B-chunk#2 deduplicated
<D> erofs: Writing chunk (4096 bytes) to 513 <--- B-chunk#3
<I> erofs: file /B-12k dumped (mode 100644)
<D> erofs: Assign nid 44 to file /root/dir/A-8k (mode 100644)
<D> erofs: Assign nid 47 to file /root/dir/B-12k (mode 100644)
<I> erofs: superblock checksum 0x1e00ad75 written
------
Filesystem UUID: 8baa7ef7-bd06-4b51-b0da-78202eb3b8fa
Filesystem total blocks: 515 (of 4096-byte blocks)
Filesystem total inodes: 3
Filesystem total metadata blocks: 1
Filesystem total deduplicated bytes (of source files): 4096
3. mount & check:
root at localhost:~# mount -o device=/dev/sdb1 /dev/sdb2 /mnt/test
root at localhost:~# diff /mnt/test/A-8k dir/A-8k
root at localhost:~# diff /mnt/test/B-12k dir/B-12k
Best Regards
Friendy Su
________________________________________
From: Gao Xiang <hsiangkao at linux.alibaba.com>
Sent: Wednesday, August 20, 2025 17:12
To: Su, Friendy; linux-erofs at lists.ozlabs.org
Cc: Mo, Yuezhang; Palmer, Daniel (SGC)
Subject: Re: [PATCH v1] erofs-utils: mkfs: Implement 'dsunit' alignment on blobdev
Hi, On 2025/8/20 17: 00, Friendy. Su@ sony. com wrote: > Hi, Gao, > > Thanks for your review ! > >> As for this patch, what if the inode itself is >> chunk-deduplicated, could we apply this if the inode >> only has
Hi,
On 2025/8/20 17:00, Friendy.Su at sony.com wrote:
> Hi, Gao,
>
> Thanks for your review !
>
>> As for this patch, what if the inode itself is
>> chunk-deduplicated, could we apply this if the inode
>> only has one new chunk instead at least for now?
>
> Do you mean inode has 3 chunks, chunk#2 and chunk#3 duplicate chunck#1?
>
> This patch only makes the 1st chunk exactly written to blobdev aligned on dsunit. Deduplicated chunks will not be written to blobdev.
>
> In example above, chunk#1 is written to dsunit aligned block addr, chunk#2,#3 are not written. The next file will be written from next dsunit alignment addr.
What's your `--chunksize` ? consider the following:
chunksize = 4096
dsunit = 512 = 2M
and two inodes:
inode A (8k) 2M, 2M+4k
inode B (12k) 4M, 2M, 4M+4k, 4M+8k?
Is it possible? what's the expected behavior of
this case.
Thanks,
Gao Xiang
>
> Best Regards
> Friendy Su
More information about the Linux-erofs
mailing list