[PATCH v2] erofs-utils: mkfs: use scandir for stable output

Gao Xiang hsiangkao at linux.alibaba.com
Tue Dec 3 17:58:17 AEDT 2024



On 2024/12/3 14:37, Jooyung Han wrote:
> (I forgot to reply all)

Yeah, I received that.

> 
> On Tue, Dec 3, 2024 at 11:36 AM Gao Xiang <hsiangkao at linux.alibaba.com> wrote:
>>
>>
>>
>> On 2024/12/3 10:20, Jooyung Han wrote:
>>> Hi Gao,
>>>
>>> I found that in the loop erofs_iget_from_srcpath() is called in
>>> different order due to readdir and erofs_iget_from_srcpath() calls
>>> erofs_new_inode() which fills i_ino[0] for newly created inode. I
>>> think this i_ino[0] having different values caused the difference in
>>> the output.
>>
>> Oh, okay, that makes sense, I think we'd better move
>>
>> inode->i_ino[0] = sbi->inos++;  /* inode serial number */
>>
>> to erofs_mkfs_dump_tree()  (since we'd better to leave
>> i_ino[0] stable even without dumping from localdir later.)
>> and even clean up a bit.
>>
>> If you don't have more time to clean up this, let's just
>> commit a patch to fix this directly.
> 
> Sounds good to me ;-)
> To be honest, I don't know the stuff well enough for this cleanup.

Ok, anyway if you could submit a patch that moves
inode->i_ino[0] = sbi->inos++;
from erofs_new_inode() to erofs_prepare_inode_buffer()

I will apply directly.

Also I'd like to update it as
inode->i_ino[0] = ++sbi->inos;

Since `i_ino == 0` is invalid...

Thanks,
Gao Xiang

> 
>>
>> Thanks,
>> Gao Xiang
> 
> Thanks,
> Jooyung



More information about the Linux-erofs mailing list