Re: Directories with 2million files

From: Dan Nelson <dnelson_at_allantgroup.com>
Date: Wed, 21 Apr 2004 16:06:14 -0500
In the last episode (Apr 21), Garance A Drosihn said:
> At 3:09 PM -0500 4/21/04, Eric Anderson wrote:
> >$ du -s
> >du: fts_read: Cannot allocate memory
> 
> Huh.  Well, that seems pretty broken...

The only allocation du does is for its hardlink cache, and it only
stores inodes with a link count >1 in it, so no amount of regular files
should make a difference.  I think it's the fts code that's at fault. 
See the fts_build function in src/lib/libc/gen/fts.c:

/*
 * This is the tricky part -- do not casually change *anything* in
 * here.  The idea is to build the linked list of entries that are used
 * by fts_children and fts_read.  There are lots of special cases.

I know building the list is required for fts_children(), but I don't
know how feasible it would be to rewrite it so a plain
fts_open()/fts_read() loop doesn't create the list internally.

-- 
	Dan Nelson
	dnelson_at_allantgroup.com
Received on Wed Apr 21 2004 - 12:06:16 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:52 UTC