[llvm] r329648 - [CachePruning] Fix comment about ext4 per-directory file limit. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 10 10:35:57 PDT 2018


On 2018-04-09, Peter Collingbourne wrote:
>Are you sure about that? I'm pretty sure that before writing that comment I
>wrote a small program that created lots of files (not subdirectories) in a
>directory until it started getting error messages, which started happening at
>around 6000000 files.
>
>Peter

I guess you created a file of 100GiB. The number of inodes is roughly 6553600.

100*1024*1024*1024 / 16384 = 6553600.0 where 16384 is the default bytes-per-inode (man mke2fs).

% truncate -s 100G 100G
% mkfs.ext4 100G
% dumpe2fs 100G
.....
Inode count:              6553600
.....

Each file consumes one inode and the number of files in that directory
is limited by this factor.

>
>On Mon, Apr 9, 2018 at 5:12 PM, Fangrui Song via llvm-commits <
>llvm-commits at lists.llvm.org> wrote:
>
>    Author: maskray
>    Date: Mon Apr  9 17:12:28 2018
>    New Revision: 329648
>
>    URL: http://llvm.org/viewvc/llvm-project?rev=329648&view=rev
>    Log:
>    [CachePruning] Fix comment about ext4 per-directory file limit. NFC
>
>    There is a limit on number of subdirectories if dir_nlinks is not
>    enabled (31998), but per-directory number of files is not limited.
>
>    Modified:
>        llvm/trunk/include/llvm/Support/CachePruning.h
>
>    Modified: llvm/trunk/include/llvm/Support/CachePruning.h
>    URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/
>    CachePruning.h?rev=329648&r1=329647&r2=329648&view=diff
>    ===========================================================================
>    ===
>    --- llvm/trunk/include/llvm/Support/CachePruning.h (original)
>    +++ llvm/trunk/include/llvm/Support/CachePruning.h Mon Apr  9 17:12:28 2018
>    @@ -52,9 +52,8 @@ struct CachePruningPolicy {
>       /// the number of files based pruning.
>       ///
>       /// This defaults to 1000000 because with that many files there are
>    -  /// diminishing returns on the effectiveness of the cache, and some file
>    -  /// systems have a limit on how many files can be contained in a
>    directory
>    -  /// (notably ext4, which is limited to around 6000000 files).
>    +  /// diminishing returns on the effectiveness of the cache, and file
>    +  /// systems have a limit on total number of files.
>       uint64_t MaxSizeFiles = 1000000;
>     };
>
>    _______________________________________________
>    llvm-commits mailing list
>    llvm-commits at lists.llvm.org
>    http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>--
>-- 
>Peter

-- 
宋方睿


More information about the llvm-commits mailing list