文件打开方式O_DSYNC、O_RSYNC、O_SYNC

O_DSYNC:

每次write都等待物理I/O完成,但是如果写操作不影响读取刚写入的数据,则不等待文件属性更新

O_RSYNC:

每个以文件描述符作为参数的read操作等待,直到所有对文件同一部分的未决写操作完成

O_SYNC:

每次write都等到物理I/O完成,包括write引起的文件属性的更新

  • O_SYNC: requires that any write operations block until all data and all metadata have been written to persistent storage.
  • O_DSYNC: like O_SYNC, except that there is no requirement to wait for any metadata changes which are not necessary to read the just-written data. In practice, O_DSYNC means that the application does not need to wait until ancillary information (the file modification time, for example) has been written to disk. Using O_DSYNC instead of O_SYNC can often eliminate the need to flush the file inode on a write.
  • O_RSYNC: this flag, which only affects read operations, must be used in combination with either O_SYNC or O_DSYNC. It will cause aread() call to block until the data (and maybe metadata) being read has been flushed to disk (if necessary). This flag thus gives the kernel the option of delaying the flushing of data to disk; any number of writes can happen, but data need not be flushed until the application reads it back.

转载于:https://www.cnblogs.com/buptlyn/p/4139407.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值