Re: Usage of truncate() with aufs

From: Robert Collins <robertc@dont-contact.us>
Date: Tue, 09 Aug 2005 10:44:36 +1000

On Mon, 2005-08-08 at 19:08 +0200, Serassio Guido wrote:
> Hi,
>
> Looking to bug #1371 (http://www.squid-cache.org/bugs/show_bug.cgi?id=1371)
> I have found the following code:
>
> void
> DiskThreadsIOStrategy::unlinkFile(char const *path)
> {
> statCounter.syscalls.disk.unlinks++;
> #if USE_TRUNCATE_NOT_UNLINK
>
> aioTruncate(path, NULL, NULL);
> #else
>
> aioUnlink(path, NULL, NULL);
> #endif
> }
>
> And in configure I'm reading:
>
> --enable-truncate This uses truncate() instead of unlink() when
> removing cache files. Truncate gives a little
> performance improvement, but may cause problems
> when used with async I/O. Truncate uses more
> filesystem inodes than unlink..
>
> So I have a doubt:
>
> #if USE_TRUNCATE_NOT_UNLINK
>
> Is an error or a trick to avoid usage of truncate() with aufs ?

Neither, its the corollary to the configure option ... the api is always
unlinkFile, but if --enable-truncate is passed, then the underlying
implementation becomes truncate.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Received on Mon Aug 08 2005 - 18:44:17 MDT

This archive was generated by hypermail pre-2.1.9 : Wed Aug 31 2005 - 12:00:06 MDT