public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: "Pádraig Brady" <P@draigBrady.com>
To: Sami Kerola <kerolasa@iki.fi>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH 3/4] lib/fileutils: advice there is no point caching temporary files
Date: Mon, 09 Sep 2013 04:23:43 +0100	[thread overview]
Message-ID: <522D3F3F.3090509@draigBrady.com> (raw)
In-Reply-To: <1378656549-3729-3-git-send-email-kerolasa@iki.fi>

On 09/08/2013 05:09 PM, Sami Kerola wrote:
> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
> ---
>  lib/fileutils.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/lib/fileutils.c b/lib/fileutils.c
> index 92b474c..23cf80c 100644
> --- a/lib/fileutils.c
> +++ b/lib/fileutils.c
> @@ -8,6 +8,7 @@
>  #include <unistd.h>
>  #include <sys/time.h>
>  #include <sys/resource.h>
> +#include <fcntl.h>
>  
>  #include "c.h"
>  #include "fileutils.h"
> @@ -43,6 +44,9 @@ int xmkstemp(char **tmpname, char *dir)
>  		free(localtmp);
>  		localtmp = NULL;
>  	}
> +#ifdef POSIX_FADV_NOREUSE
> +	posix_fadvise(fd, 0, lseek(fd, 0, 0), POSIX_FADV_NOREUSE);
> +#endif
>  	*tmpname = localtmp;
>  	return fd;
>  }
> 

I don't follow. The above is saying to NOREUSE the data
from the start to the current position?
But won't the file be empty and the current position == 0 here?
Also POSIX_FADV_NOREUSE currently does nothing in the kernel.
There is POSIX_FADV_DONTNEED to drop the file (range) from cache.
But I'm not sure that's appropriate or needed for all temp files?
Note also DONTNEED is auto done when a file is unlinked.

cheers,
Pádraig.


  reply	other threads:[~2013-09-09  3:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-08 16:09 [PATCH 1/4] last: fix memory leak Sami Kerola
2013-09-08 16:09 ` [PATCH 2/4] tools: generate autotools files if missing Sami Kerola
2013-09-10 11:13   ` Karel Zak
2013-09-08 16:09 ` [PATCH 3/4] lib/fileutils: advice there is no point caching temporary files Sami Kerola
2013-09-09  3:23   ` Pádraig Brady [this message]
2013-09-10  7:11     ` Sami Kerola
2013-09-08 16:09 ` [PATCH 4/4] hexdump: revert global exitval variable change Sami Kerola
2013-09-10 11:14   ` Karel Zak
2013-09-10 11:13 ` [PATCH 1/4] last: fix memory leak Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=522D3F3F.3090509@draigBrady.com \
    --to=p@draigbrady.com \
    --cc=kerolasa@iki.fi \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox