From mboxrd@z Thu Jan 1 00:00:00 1970 From: Erik Mouw Subject: Re: ext2/3 subdirectory limit [WAS: Choosing and tuning Linux file systems] Date: Mon, 26 Jun 2006 14:59:00 +0200 Message-ID: <20060626125859.GC3114@harddisk-recovery.com> References: <20060625220052.GX19196@goober> <20060626111024.GB3114@harddisk-recovery.com> <20060626123635.GA15200@fspc268> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org Return-path: Received: from dtp.xs4all.nl ([80.126.206.180]:29170 "HELO abra2.bitwizard.nl") by vger.kernel.org with SMTP id S932172AbWFZM7B (ORCPT ); Mon, 26 Jun 2006 08:59:01 -0400 To: Tomas Hruby Content-Disposition: inline In-Reply-To: <20060626123635.GA15200@fspc268> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Mon, Jun 26, 2006 at 02:36:35PM +0200, Tomas Hruby wrote: > > > More than ~32,000 files in one directory: XFS or reiser > > > > Ext3 can easily have more than 32000 *files* in a directory. However, > > it can only have 32000 *subdirectories* in a directory. This limit is > > from struct ext3_inode->i_links_count, which is an __le16: each > > subdirectory has an entry ".." that links back to its parent increasing > > the parents i_links_count. > > I was always wondering why it increases link_count of the parent directory when > creating a subdirectory. It is clear that .. points to the parent, but the > subdirectory cannot exist without its parent and you cannot delete the parent if > it is not empty. Correct me if I am wrong. It is an elegant way: an inode can only be deleted when the link count is zero. The fastest way to figure that out for directories would be to let subdirs increase the parent link count: you just have look up the link count in the parent instead of going through all directory entries searching for possible subdirectories. Erik -- +-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 -- | Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands