Re: block device/VM question

Peter T. Breuer (ptb@it.uc3m.es)
Tue, 27 Aug 2002 18:32:54 +0200 (MET DST)


"A month of sundays ago Thunder from the hill wrote:"
> On Tue, 27 Aug 2002, Peter T. Breuer wrote:
> > Yes, I've noticed this in the 2.5.31 kernel. This is something
> > to be done on open by the overlying fs or userspace utility, or
> > should I set the flag on the inode->filp (or whatever) myself in
> > the drivers open function? And do I need to define
> > inode->mapping->a_ops->direct_IO()? (sorry - but I haven't had time to
> > experiment yet today!).
>
> Why so rough?

Rough? You mean "approximate"? I was working from my vague mamory of
what I read in the code on the train this morning.

> > It looks like the 2.5 kernel has this pathway, but what about the 2.4
> > kernel? Nothing.
>
> The manpage claims:
>
> O_DIRECT
> This flag is supported on a number of Unix-like systems;
> support was added under Linux in kernel version 2.4.10.

My manpage for open(2) claims no such thing. It doesn't mention
O_DIRECT. Maybe your libc6 is newer.

In any case, it doesn't make it clear to me if I have to set the flag
in the driver. Well, anyway, I'll set it.

> Also:
>
> A semantically similar interface for block devices is
> described in raw(8).

That's nothing like, since it's a character device that they were
describing. But yes, reading drivers/char/raw.c led me to see the
pathway via direct_IO() in 2.5.31, but in the 2.4.19 kernel the path is
obscure. In 2.5.31 it's clear that mm/filemap.c does pay attention to the
flag, and YES, you are right, in 2.4.19, generic_file_read() does
look at the flag. However, I have not much idea where that filp
comes from or what it represents. Oh, well, thanks.I suppose
you won't give me a recipe saying "do this and your device won't be
cached", but I'll follow the lead.

Thanks again.

Peter

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