linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Btrfs st_nlink for directories
@ 2010-01-23  2:28 Neil Schemenauer
  2010-01-23 20:42 ` Aneesh Kumar K. V
  0 siblings, 1 reply; 3+ messages in thread
From: Neil Schemenauer @ 2010-01-23  2:28 UTC (permalink / raw)
  To: linux-btrfs

Hi,

It looks like Btrfs does not follow Unix traditions for st_nlink
attribute of directories. It seems to be always one, no matter the
number of sub-directories.

Is this intentional? I couldn't find it discussed anywhere. I
gather the Mac OS HFS+ doesn't follow traditional st_nlink behavior
as well. The 'find' man page has this note:

   -noleaf
          Do  not  optimize  by  assuming that directories contain 2 fewer
          subdirectories than their  hard  link  count.   This  option  is
          needed  when  searching  filesystems that do not follow the Unix
          directory-link convention, such as CD-ROM or MS-DOS  filesystems
          or  AFS  volume  mount  points.  Each directory on a normal Unix
          filesystem has at least 2 hard  links:  its  name  and  its  `.'
          entry.   Additionally,  its  subdirectories (if any) each have a
          `..'  entry linked to that directory.  When find is examining  a
          directory,  after it has statted 2 fewer subdirectories than the
          directory's link count, it knows that the rest of the entries in
          the directory are non-directories (`leaf' files in the directory
          tree).  If only the files' names need to be examined,  there  is
          no  need  to  stat  them;  this  gives a significant increase in
          search speed.

Regards,

  Neil

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-24  0:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-23  2:28 Btrfs st_nlink for directories Neil Schemenauer
2010-01-23 20:42 ` Aneesh Kumar K. V
2010-01-24  0:33   ` Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).