fsync的顺序/方向重要吗?

Does the order/direction of fsync matter?

本文关键字:方向 顺序 fsync      更新时间:2023-10-16

假设我将一些文件和目录写入u盘。

/media/drive1/newFolder1/
/media/drive1/newFolder1/newfile1
/media/drive1/newFolder1/newfile2

我已经创建了一个文件夹newFolder1和两个文件newfile1newfile2

同步不会自动发生,所以我需要fsync更改。

所以我需要在newFolder1, newfile1newfile2上调用fsync

问题是,我做这些的顺序有关系吗?

这对内容没有影响,但是如果目录没有在文件之后同步,那么最后修改时间可能是错误的。