tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Max. number of subdirectories dump



On 2013-08-19 08:41, David Holland wrote:
On Sun, Aug 18, 2013 at 06:04:55PM +0200, Johnny Billquist wrote:
  > Looking at 2.11BSD, it looks like this:
  >
  > struct  direct {
  > [snip]
  >
  > In NetBSD (fairly current):
  >
  > struct dirent {

careful, you want struct direct, not struct dirent:

Hmm. Probably a good point. I was wondering if NetBSD had just renamed direct to dirent, but that was just me getting confused then. (And lazy, since I didn't really search around, which I should have, but the rest matched so well. :-) )

However...

struct  direct {
         u_int32_t d_fileno;             /* inode number of entry */
         u_int16_t d_reclen;             /* length of this record */
         u_int8_t  d_type;               /* file type, see below */
         u_int8_t  d_namlen;             /* length of string in d_name */
         char      d_name[FFS_MAXNAMLEN + 1];/* name with length <= 
FFS_MAXNAMLEN */
};

not that it's actually much different.

I was reading the manpage on dirent for NetBSD 3 previously, and it looked like that as well. Obviously, for this, FFS_MAXNAMLEN must be 255 or less... (Well, ok, it can be larger, but the actual name stored in d_name will not be more than 255 characters anyway...)

That was part of the reason that even triggered me to check somewhat current sources.

  > It's an obvious optimization to keep type already in the directory
  > itself. But is there any other reason why it was added there?

Speed. There's a moderately famous paper "A trace-driven analysis of
the UNIX 4.2 BSD file system" -- you might have heard of it :-)

Actually I haven't. I should look it up. Thanks.
And speed was the obvious optimization that I was thinking of. (Apparently not so obvious, so I should learn to not write such things.)

        Johnny

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index