Does the order/direction of fsync matter?
题
Let's say I write out some files and directories to a usb thumb drive.
/media/drive1/newFolder1/
/media/drive1/newFolder1/newfile1
/media/drive1/newFolder1/newfile2
I've created a folder, newFolder1
and two files newfile1
and newfile2
.
Syncing does not happen automatically, so I'd need to fsync
the changes.
So I need to call fsync
on newFolder1
, newfile1
and newfile2
.
Question is, does it matter the order in which I do this?
解决方案
It won't matter for content, but last-modified-times could be wrong if the directory is not synced after the files.
不隶属于 StackOverflow