保证磁盘缓存已使用 fsync 刷新

Guarantee disk cache was flushed with fsync

我了解到 fsync system call 将脏数据从内核缓冲区缓存(页面缓存)移动到 HDD。它是否保证硬盘将所述数据从其内部缓存移动到盘片?

愚蠢的我,我再次阅读了文档,它清楚地指出(已编辑):

fsync() transfers ... all modified in-core data of ... the file referred to by the file descriptor fd to the disk device ... so that all changed information can be retrieved even after system crashed ... This includes writing through or flushing a disk cache if present.