Re: open(O_DIRECT) on a tmpfs?

From: Bodo Eggert
Date: Thu Jan 04 2007 - 09:58:11 EST


Michael Tokarev <mjt@xxxxxxxxxx> wrote:

> I wonder why open() with O_DIRECT (for example) bit set is
> disallowed on a tmpfs (again, for example) filesystem,
> returning EINVAL.
>
> Yes, the question may seems strange a bit, because of two
> somewhat conflicting reasons. First, there's no reason to
> use O_DIRECT with tmpfs in a first place, because tmpfs does
> not have backing store at all, so there's no place to do
> direct writes to. But on another hand, again due to the very
> nature of tmpfs, there's no reason not to allow O_DIRECT
> open and just ignore it, -- exactly because there's no
> backing store for this filesystem.

I'm using a tmpfs as a mostly-ramdisk, that is I've set up a large swap
partition in case I need the RAM instead of using it for a filesystem.
Therefore it will sometimes have a backing store.

OTOH, ramfs does not have this property (the cache is the backing store),
so it would make sense to allow it at least there.

BTW: Maybe you could use a ramdisk instead of the loop-on-tmpfs.
--
Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF
verbreiteten Lügen zu sabotieren.

http://david.woodhou.se/why-not-spf.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/