Syncing Files
Finally, we need to implement the fsync file operation, for both files
and directories. The function is stamfs_sync_file:
- Take the inode from the given dentry parameter.
- Sync the buffers related to the inode (in our case, that's the inode's
buffer-head and the block index buffer-head).
- Sync the data buffers of the file.
- If the inode itself is dirty, write the inode to disk in a synchronous
manner.
Here is the files-with-data STAMFS code.
Originally written by
guy keren