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

Sami Kerola
2013-09-10T07:11:44Z

On 9 September 2013 04:23, Pádraig Brady <P@draigbrady.com> wrote:
> On 09/08/2013 05:09 PM, Sami Kerola wrote:
>> +#ifdef POSIX_FADV_NOREUSE
>> + posix_fadvise(fd, 0, lseek(fd, 0, 0), POSIX_FADV_NOREUSE);
>> +#endif
>
> 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.

Hi Pádraig,

I misunderstood posix_fadvice() manual page. Thank you for explaining
how caching instructions work. Perhaps adding a note to
posix_fadvise(3P) about unlinking and DONOTNEED would be appropriate.
That, after all, makes manual fiddling with this function pointless in
cases like I proposed.

--
Sami Kerola