erofs-utils: mkfs: make output stable
PATCH 1/1 erofs-utils: mkfs: make output stable
The iteration order of opendir/readdir depends on filesystem implementation. Initializng inode->i_ino[0] in the loop causes the output unstable even though the entries are sorted in erofs_prepare_dir_file().
In this change, inode->i_ino[0] is initialized in erofs_prepare_inode_buffer() instead to make the output stable. (not affected by readdir())
Test: mkfs.erofs ... inputdir(ext3)
Test: mkfs.erofs ... inputdir(tmpfs)
# should generate the same output Change-Id: I41bb8d5487a77b83dfa69d3d085e38223ab17f87 Signed-off-by: Jooyung Han <[email protected]> --- lib/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/inode.c +1 -1
@@ -821,6 +821,7 @@ noinline: bh->fsprivate =erofs_igrab (inode); bh->op = &erofs_write_inode_bhops; inode->bh = bh; + inode->i_ino[0 ] = ++inode->sbi->inos;/* inode serial number */ return 0 ; }
@@ -1114,7 +1115,6 @@ struct erofs_inode *erofs_new_inode(struct erofs_sb_info *sbi)return ERR_PTR (-ENOMEM ); inode->sbi = sbi; - inode->i_ino[0 ] = sbi->inos++;/* inode serial number */ inode->i_count =1 ; inode->datalayout =EROFS_INODE_FLAT_PLAIN ;
Signature · 1 line
2.47.0.338.g60cca15819-goog
Gao Xiang
AppliedQuoted 9 lines · Jooyung Han
The iteration order of opendir/readdir depends on filesystem implementation. Initializng inode->i_ino[0] in the loop causes the output unstable even though the entries are sorted in
erofs_prepare_dir_file().In this change, inode->i_ino[0] is initialized in
erofs_prepare_inode_buffer()instead to make the output stable. (not affected byreaddir())
Quoted 5 lines
Test: mkfs.erofs ... inputdir(ext3)
Test: mkfs.erofs ... inputdir(tmpfs)# should generate the same output Change-Id: I41bb8d5487a77b83dfa69d3d085e38223ab17f87 Signed-off-by: Jooyung Han <[email protected]>
Thanks, applied without Change-Id tag.
Thanks,
Gao Xiang