This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Write a file to USB with O_DIRECT flag

Hello.

I have exactly the same question (except that my writing is to the USB and not to SATA disk) as discussed in:

http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/242361

For some unclear reason, this question is cut exactly before the answer.

I will be extremely thankful for the answer!!

  • Hello,

    We havent tried using O_DIRECT with CMEM memory before - please note that CMEM allocated memory is not coming from the directly mapped memory pool managed by Linux. If ioremap() is used internally for creating the CMEM memory pool(which i believe it is), then the memory coming from the CMEM pool is regarded as IO memory and hence a linear translation between the physical and virtual address for the buffer will not work.

    If you are intent is to by-pass the Linux Buffer cache(for streaming data kind of use case), you have other means to achieve this like using posix_fadvise() call rather than using O_DIRECT for this.

    O_DIRECT could imply restictions on the size, alignment of the buffer used and AFAIK should work well for memory allocated from user-space or allocated by the linux kernel(and mmaped to user space)

    http://processors.wiki.ti.com/index.php/TI_SATA_FAQ#How_to_tune_Performance_and_CPU_utilization

    BR
    Pavel