日期:2014-05-16  浏览次数:20565 次

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


不知道 这样理解对不对?

------解决方案--------------------
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).

------解决方案--------------------
探讨
使用DMA的话
linux的DMA是低端内存 也就那么点 给磁盘控制器使用 够用不?

------解决方案--------------------
楼上说的没错啦。
你说的磁盘缓存机制和DMA没有关系的。
现在一般的DMA应该都是支持32位地址了。

你说那个缓存是文件系统或者block驱动层的,

就算你block驱动层不使用缓存,到了下面的磁盘驱动里面哪里还是会使用DMA来进行的。