[lkml]   [2007]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: open(O_DIRECT) on a tmpfs?
On 04/01/07, Hua Zhong <> wrote:
> > I see that as a good argument _not_ to allow O_DIRECT on
> > tmpfs, which inevitably impacts cache, even if O_DIRECT were
> > requested.
> >
> > But I'd also expect any app requesting O_DIRECT in that way,
> > as a caring citizen, to fall back to going without O_DIRECT
> > when it's not supported.
> According to "man 2 open" on my system:
> 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 situations, such as when applications do their own
> caching. File I/O is done directly to/from user space buffers.
> The I/O is synchronous, i.e., at the completion of the read(2)
> or write(2) system call, data is guaranteed to have been trans-
> ferred. Under Linux 2.4 transfer sizes, and the alignment of
> user buffer and file offset must all be multiples of the logi-
> cal block size of the file system. Under Linux 2.6 alignment to
> 512-byte boundaries suffices.
> A semantically similar interface for block devices is described
> in raw(8).
> This says nothing about (probably disk based) persistent backing store. I don't see why tmpfs has to conflict with it.
> So I'd argue that it makes more sense to support O_DIRECT on tmpfs as the memory IS the backing store.

I'd agree. O_DIRECT means data will go direct to backing store, so if
RAM *is* the backing store as in the tmpfs case, then I see why
O_DIRECT should fail for it...

I often use tmpfs when I want to test new setups - it's easy to get
rid of again and it's fast during testing. Why shouldn't I be able to
test apps that use O_DIRECT this way?

Jesper Juhl <>
Don't top-post
Plain text mails only, please
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-01-05 16:01    [W:0.117 / U:11.112 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site