[lld] r318857 - CachePruning: Allow limiting the number of files in the cache directory.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 10:27:31 PST 2017


Author: pcc
Date: Wed Nov 22 10:27:31 2017
New Revision: 318857

URL: http://llvm.org/viewvc/llvm-project?rev=318857&view=rev
Log:
CachePruning: Allow limiting the number of files in the cache directory.

The default limit is 1000000 but it can be configured with a cache
policy. The motivation is that some filesystems (notably ext4) have
a limit on the number of files that can be contained in a directory
(separate from the inode limit).

Differential Revision: https://reviews.llvm.org/D40327

Modified:
    lld/trunk/test/ELF/lto/cache.ll

Modified: lld/trunk/test/ELF/lto/cache.ll
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/cache.ll?rev=318857&r1=318856&r2=318857&view=diff
==============================================================================
--- lld/trunk/test/ELF/lto/cache.ll (original)
+++ lld/trunk/test/ELF/lto/cache.ll Wed Nov 22 10:27:31 2017
@@ -23,6 +23,14 @@
 ; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy cache_size_bytes=32k:prune_interval=0s -o %t3 %t2.o %t.o
 ; RUN: ls %t.cache | count 4
 
+; Setting max number of files to 0 should disable the limit, not delete everything.
+; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy prune_after=0s:cache_size=0%:cache_size_files=0:prune_interval=0s -o %t3 %t2.o %t.o
+; RUN: ls %t.cache | count 4
+
+; Delete everything except for the timestamp, "foo" and one cache file.
+; RUN: ld.lld --thinlto-cache-dir=%t.cache --thinlto-cache-policy prune_after=0s:cache_size=0%:cache_size_files=1:prune_interval=0s -o %t3 %t2.o %t.o
+; RUN: ls %t.cache | count 3
+
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"
 




More information about the llvm-commits mailing list