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

Zbyszek Jędrzejewski-Szmek zbyszek at in.waw.pl
Fri Sep 24 03:43:36 PDT 2010


On Fri, Sep 24, 2010 at 12:05:59PM +0200, harald at redhat.com wrote:
> From: Harald Hoyer <harald at redhat.com>
> 
> ---
>  src/readahead-replay.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/readahead-replay.c b/src/readahead-replay.c
> index b886857..f4d252b 100644
> --- a/src/readahead-replay.c
> +++ b/src/readahead-replay.c
> @@ -85,7 +85,7 @@ static int unpack_file(FILE *pack) {
>                  any = true;
>  
>                  if (fd >= 0)
> -                        if (readahead(fd, b * PAGE_SIZE, (c - b) * PAGE_SIZE) < 0) {
> +                        if (posix_fadvise(fd, b * PAGE_SIZE, (c - b) * PAGE_SIZE, POSIX_FADV_WILLNEED) < 0) {
>                                  log_warning("readahead() failed: %m");
                                                ^also here
>                                  goto finish;
>                          }
> @@ -96,7 +96,7 @@ static int unpack_file(FILE *pack) {
>                   * intended to mean that the whole file shall be
>                   * read */
>  
> -                if (readahead(fd, 0, st.st_size) < 0) {
> +                if (posix_fadvise(fd, 0, st.st_size, POSIX_FADV_WILLNEED) < 0) {
>                          log_warning("readahead() failed: %m");
                                        ^here too
>                          goto finish;
>                  }

-
Zbyszek


More information about the systemd-devel mailing list