From owner-freebsd-current@FreeBSD.ORG Wed Apr 21 14:06:16 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA7C416A4CE for ; Wed, 21 Apr 2004 14:06:16 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4630243D39 for ; Wed, 21 Apr 2004 14:06:16 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.10/8.12.10) id i3LL6Efg071859; Wed, 21 Apr 2004 16:06:14 -0500 (CDT) (envelope-from dan) Date: Wed, 21 Apr 2004 16:06:14 -0500 From: Dan Nelson To: Garance A Drosihn Message-ID: <20040421210613.GC61380@dan.emsphone.com> References: <40867A5D.9010600@centtech.com> <4086D513.9010605@centtech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 5.2-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.6i cc: freebsd-current@freebsd.org cc: Eric Anderson Subject: Re: Directories with 2million files X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2004 21:06:16 -0000 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@allantgroup.com