<div dir="auto">Thanks… Another thing, I’m happy to help writing English documentation for EROFS if you have a Chinese version.</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 20, 2021 at 10:04 Gao Xiang <<a href="mailto:hsiangkao@linux.alibaba.com">hsiangkao@linux.alibaba.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">On Mon, Dec 20, 2021 at 10:53:10PM +0800, Gao Xiang wrote:<br>
> Hi Kelvin,<br>
> <br>
> On Mon, Dec 20, 2021 at 08:45:42AM -0500, Kelvin Zhang wrote:<br>
> > Hi Gao,<br>
> >     I was playing with large pcluster sizes recently, I noticed a<br>
> > quirk about EROFS. In summary, logical cluster size has a practical<br>
> > limit of 8MB. Here's why:<br>
> > <br>
> >    Looking at <a href="https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/tree/lib/compress.c?h=experimental&id=564adb0a852b38a1790db20516862fc31bca314d#n92" rel="noreferrer" target="_blank">https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/tree/lib/compress.c?h=experimental&id=564adb0a852b38a1790db20516862fc31bca314d#n92</a><br>
> > , line 92, we see the following code:<br>
> > <br>
> > if (d0 == 1 && erofs_sb_has_big_pcluster()) {<br>
> >         type = Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD;<br>
> >         di.di_u.delta[0] = cpu_to_le16(ctx->compressedblks |<br>
> >                 Z_EROFS_VLE_DI_D0_CBLKCNT); // This line<br>
> >         di.di_u.delta[1] = cpu_to_le16(d1);<br>
> > } else if (d0) {<br>
> >         type = Z_EROFS_VLE_CLUSTER_TYPE_NONHEAD;<br>
> > <br>
> >         di.di_u.delta[0] = cpu_to_le16(d0);  // and this line<br>
> >         di.di_u.delta[1] = cpu_to_le16(d1);<br>
> > }<br>
> > <br>
> > When a compressed index has type NOHEAD, delta[0] stores d0(distance<br>
> > to head block). But The 11th bit of d0 is also used as a flag bit to<br>
> > indicate that d0 stores the pcluster size. This means d0 cannot exceed<br>
> > Z_EROFS_VLE_DI_D0_CBLKCNT(2048), or else the parser will incorrectly<br>
> > interpret d0 as pcluster size, rather than distance to head block.<br>
> >     Is this an intentional design choice? It's not necessarily bad,<br>
> > but it's something I think is worth documenting in code.<br>
> <br>
> Thanks for this great insight! Actually on-disk EROFS format doesn't<br>
> have such limitation by design, since if it looks back to the delta0<br>
> lcluster and it's still a NONHEAD lcluster, it will look back with<br>
> new delta0 again until finding the final HEAD lcluster.<br>
> <br>
> But I'm not sure if mkfs code can handle > 8MiB lcluster properly yet,<br>
> without modification since lcluster size is strictly limited with<br>
> <a href="https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/tree/include/erofs/compress.h#n14" rel="noreferrer" target="_blank">https://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs-utils.git/tree/include/erofs/compress.h#n14</a><br>
> EROFS_CONFIG_COMPR_MAX_SZ * 2<br>
> <br>
> Yeah, I have to admit the current document might not be so detailed,<br>
> partially due to my somewhat bad English written speed, and limited<br>
> time...<br>
<br>
By the way, I'd like to correct some concepts here (sorry I didn't use<br>
them correctly in my previous email).<br>
<br>
A lcluster includes a HEAD or NONHEAD lcluster, currently only 4KiB<br>
is supported.<br>
A pcluster contains arbitrary compressed blocks, which can be<br>
decompressed independently.<br>
A compressed extent matches a pcluster, and several lclusters (maybe<br>
partially).<br>
<br>
So strictly speaking is "practical Limit on EROFS compressed extent<br>
size"...<br>
<br>
> <br>
> Thanks,<br>
> Gao Xiang<br>
> <br>
> > <br>
> > <br>
> > -- <br>
> > Sincerely,<br>
> > <br>
> > Kelvin Zhang<br>
</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Sincerely,<div><br></div><div>Kelvin Zhang</div></div></div>