Re: Non-blocking read

Stephen C. Tweedie (sct@redhat.com)
Fri, 18 Jun 1999 00:27:51 +0100 (BST)


Hi,

On Mon, 14 Jun 1999 20:08:36 +0200 (CEST), Arjan van de Ven
<arjan@fenrus.demon.nl> said:

> I want to do a non-blocking read from a file, from within the kernel.
> Is this, at all, possible? I have been tracing how userspace does
> this, but the userspace does not seem to be non-blocking either.

For regular files, that is correct. But...

> * non-blocking read is issued
> * if the pages are in the pagecache, they are copied to my buffer
> * if they are not, an asynchronous read-ahead is issued and the
> read-funtion returns -EAGAIN

...to do this in the kernel, look at the readahead code: that populates
the page cache asynchronously. There just isn't any high-level function
which does that automatically for you: you need to do all the setup
yourself.

--Stephen

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