+ -
当前位置:首页 → 问答吧 → 磁盘控制器是通过DMA来传输数据的?

磁盘控制器是通过DMA来传输数据的?

时间:2011-11-28

来源:互联网

如果开启了O_DIRECT 磁盘控制器是通过DMA来传输数据的?
如果不是 就不是通过DMA方式了 而是采用缓存的方式


不知道 这样理解对不对?

作者: softirq_2   发布时间: 2011-11-28

C/C++ code

       O_DIRECT (Since Linux 2.4.10)
              Try to minimize cache effects of the I/O to and from this file.  In general this will degrade performance, but it is useful in special sit‐
              uations,  such  as when applications do their own caching.  File I/O is done directly to/from user space buffers.  The O_DIRECT flag on its
              own makes at an effort to transfer data synchronously, but does not give the guarantees of the O_SYNC that data and necessary metadata  are
              transferred.  To guarantee synchronous I/O the O_SYNC must be used in addition to O_DIRECT.  See NOTES below for further discussion.

              A semantically similar (but deprecated) interface for block devices is described in raw(8).




也就是连内核级别的缓冲都不用了,性能会下降,如果用户喜欢自己做足够的缓冲的话用一下也是可以的,不过这种同步写和O_SYNC是不同的,O_SYNC保证元数据会正确的缓冲在内核,尽量减少数据损失,并且实际写磁盘后才返回。但DIRECT并不能提供基本保障,因为它完全没缓冲。 所以,这两个参数通常一起使用,缓冲元数据,并且绕过内核缓冲。

作者: qq120848369   发布时间: 2011-11-28

热门下载

更多