Re: [PATCH 3/4] lib/fileutils: advice there is no point caching temporary files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 09/08/2013 05:09 PM, Sami Kerola wrote:
> Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
> ---
>  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.

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux