Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Mar 1997 16:03:36 +0000 (GMT)
From:      Jeremy Prior <jez@netcraft.co.uk>
To:        freebsd-hackers@freebsd.org
Subject:   Hard Link Count too small!
Message-ID:  <199703071603.QAA10735@server.netcraft.co.uk>

next in thread | raw e-mail | index | archive | help
All,
    I've written an application that uses the filesystem to store
hierarchical data, and I'm running up against the fact that files (and
therefore directories) can't have more than 32767 hard links!

    Specifically, the following will create a directory with 32765
subdirectories (not including `.', & `..') before bailing:

    % mkdir tmp
    % cd tmp
    % perl -e '1 while (mkdir(++$c, 0755))'

(you might want to mount the filesystem async beforehand :-)

    % ls -fa | wc -l 
       32767

Looking at /usr/include/sys/stat.h and sys/types.h, I see that the hard link
count (st_nlink) is actually an unsigned short (u_int16_t), so
theoretically, I should be able to create 65533 directories before bombing
out.  This would certainly `solve' my problem in the short term, until I can
get around to `fixing' it properly.

So, could someone more knowledgeable about filesystem internals tell me why
st_nlink is behaving like a signed short, and what I can do about it?

Thanks in advance,
jez
--
Jeremy Prior                                      <jez@netcraft.co.uk>
Netcraft,  Rockfield House,  Granville Road,  Bath,  BA1 9BQ,  England
Tel: +44-1225-447500                              Fax: +44-1225-448600



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703071603.QAA10735>