Very late one night, we think :) It was added in linux-2.4.13-pre4.
> - As far as i understand the code it reads the data into
> the page cache. The data is ready sync and there is no
> way to do this async and have a notification unless using
> a separate thread.
It is async. The call will submit the IO and will return immediately.
It could block on things like memory shortage, request queue exhaustion,
but this is unlikely, and pretty much any syscall could block under these
conditions.
You should be able to poll the status of the readhead pages by mmapping
the relevant section of the file and then using mincore() to find out if
the IO has completed.
> A typical use i could see is preloading some data in the
> page cache from a separate thread (eg. for a media player).
Or from the same thread.
> BTW: AFAICS the code is off by one if offset/count is not in
> PAGE_SIZE chunks?
>
> unsigned long start = offset >> PAGE_CACHE_SHIFT;
> unsigned long len = (count + ((long)offset & ~PAGE_CACHE_MASK)) >> PAGE_CACHE_SHIFT;
Looks like it. If offset is zero and count is 4097, it will only read
one page.
-
-
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/