On 2023/8/14 11:42, Jingbo Xu wrote:
In index mode for tarerofs, tarerofs_write_chunk_indexes() is still called
even for files with 0 i_size, and inode->u.chunkformat is initialized
accordingly. This will make the previously set inode->u.i_rdev be
overridden as u.chunkformat and u.i_rdev are reused in one union.
To tidy up the code of writing file, extract two helpers writing file in
index and non-index mode. Also fix the missing erofs_iput() when
tarerofs_write_chunkes() fails.
Fixes: 95d315fd7958 ("erofs-utils: introduce tarerofs")
Signed-off-by: Jingbo Xu <[email protected]>
Reviewed-by: Gao Xiang <[email protected]>
Thanks,
Gao Xiang