Date: Mon, 12 Apr 1999 13:30:01 +0930 From: Greg Lehey <grog@lemis.com> To: "Randy A. Katz" <randyk@ccsales.com> Cc: FreeBSD Questions <questions@FreeBSD.org> Subject: Re: Too many links Message-ID: <19990412133001.M2142@lemis.com> 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 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990412133001.M2142>