[systemd-devel] [PATCH 1/6] readahead-replay: use posix_fadvise instead of readahead

Lennart Poettering lennart at poettering.net
Sun Sep 26 16:46:50 PDT 2010


On Fri, 24.09.10 12:54, harald at redhat.com (harald at redhat.com) wrote:

> @@ -96,8 +96,8 @@ static int unpack_file(FILE *pack) {
>                   * intended to mean that the whole file shall be
>                   * read */
>  
> -                if (readahead(fd, 0, st.st_size) < 0) {
> -                        log_warning("readahead() failed: %m");
> +                if (posix_fadvise(fd, 0, st.st_size, POSIX_FADV_WILLNEED) < 0) {
> +                        log_warning("posix_fadvise() failed: %m");
>                          goto finish;
>                  }
>          }

Thanks! Applied.

I think conceptionally it is more appropriate to use posix_fadvise()
here which is why I merged this patch for now. However, there are three
questions this opens: 1) is fadvise() actually influenced by
ioprio_set() the same way as readahead() or read() are? 2) are the read
requests canceled by a close() on the same fd? 3) what happens when we
queue more read requests this way than the block device q can handle?
will fadvise() become blocking (which would be great)? or are requests
droppped then, and which ones would those be, the queued ones or the
ones we try to enqueue?

I have now asked for clarficiations from some fs hackers, let's see what
they'll say.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list