From owner-freebsd-questions Sun Apr 11 21: 2:30 1999 Delivered-To: freebsd-questions@freebsd.org Received: from allegro.lemis.com (allegro.lemis.com [192.109.197.134]) by hub.freebsd.org (Postfix) with ESMTP id 575921521B for ; Sun, 11 Apr 1999 21:02:23 -0700 (PDT) (envelope-from grog@freebie.lemis.com) Received: from freebie.lemis.com (freebie.lemis.com [192.109.197.137]) by allegro.lemis.com (8.9.1/8.9.0) with ESMTP id NAA08248; Mon, 12 Apr 1999 13:30:03 +0930 (CST) Received: (from grog@localhost) by freebie.lemis.com (8.9.3/8.9.0) id NAA69425; Mon, 12 Apr 1999 13:30:02 +0930 (CST) Message-ID: <19990412133001.M2142@lemis.com> Date: Mon, 12 Apr 1999 13:30:01 +0930 From: Greg Lehey To: "Randy A. Katz" Cc: FreeBSD Questions Subject: Re: Too many links References: <3.0.5.32.19990412065446.05330240@ccsales.com> <3.0.5.32.19990412065446.05330240@ccsales.com> <19990412121738.I2142@lemis.com> <3.0.5.32.19990412075901.045aa6c0@ccsales.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2i In-Reply-To: <3.0.5.32.19990412075901.045aa6c0@ccsales.com>; from Randy A. Katz on Mon, Apr 12, 1999 at 07:59:01AM -0700 WWW-Home-Page: http://www.lemis.com/~grog Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-41-739-7062 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Please note in my .sig: >> When replying to this message, please copy the original recipients. >> For more information, see http://www.lemis.com/questions.html On Monday, 12 April 1999 at 7:59:01 -0700, Randy A. Katz wrote: > At 12:17 PM 4/12/99 +0930, you wrote: >> On Monday, 12 April 1999 at 6:54:46 -0700, Randy A. Katz wrote: >>> Hello, >>> >>> I've got a directory which has a ton of directories under it. Now, when I >>> try to create another directory it says: Too may links. >>> >>> Does anyone know what must be done? >> >> Don't create any more directories? >> >> Seriously, it's a performance issue. The current limit is in >> /usr/include/sys/syslimits.h: >> >> #define LINK_MAX 32767 /* max file link count */ >> >> Theoretically you could just increase this value and 'make world', but >> you might run into int overflow problems. I certainly think that >> there are better alternatives to this issue than adding yet more >> directories to one which is too full already. > > Thank you, that info is very helpful, However, can I change LINK_MAX or > not? Sure, you can change it, I just don't think it's a very good idea. You might even just be able to put it in your kernel config: option "LINK_MAX=16384" # less maxlinks than normal What you can't do is to increase it. > I need a lot of directories in order to be able to keep adding > members to this web site...it's not database driven, they are static > pages which are generated at signup and they must sit in directories > as such...do you know what problems can or will arise from, say, > doubling or quadrupling LINK_MAX??? OK, I've checked. The first problem is that ufs stores this value in the inode: struct dinode { u_int16_t di_mode; /* 0: IFMT, permissions; see below. */ int16_t di_nlink; /* 2: File link count. */ int16_t is a 16 bit signed integer. That means that there is no way you can quadruple it, the most you could hope for is to double it to 65535. You *might* be able to do this by changing the int16_t there to a u_int16_t, but then you'd have to rewrite code like this (from ufs/ufs/ufs_inode.c): if (ip->i_nlink <= 0 && (vp->v_mount->mnt_flag & MNT_RDONLY) == 0) { In other words, there is really no practical way to increase the number of links. In any case, you could expect really bad performance (opening a file, or even looking for a file in one of the subdirectories, requires reading half the directory, which must already be about 500 kB large). The obvious thing to do is to create another directory level. Greg -- When replying to this message, please copy the original recipients. For more information, see http://www.lemis.com/questions.html See complete headers for address, home page and phone numbers finger grog@lemis.com for PGP public key To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message