From: Martin Steigerwald <martin@lichtvoll.de>
To: dsterba@suse.cz
Cc: linux-btrfs@vger.kernel.org
Subject: Re: number of hardlinks for directory in ls -lid always 1?
Date: Wed, 18 Mar 2015 15:23:50 +0100 [thread overview]
Message-ID: <7757761.93uGJVH8dW@merkaba> (raw)
In-Reply-To: <20150318135230.GA20767@twin.jikos.cz>
Am Mittwoch, 18. März 2015, 14:52:30 schrieb David Sterba:
> On Wed, Mar 18, 2015 at 02:31:43PM +0100, Martin Steigerwald wrote:
> > Am Dienstag, 17. März 2015, 17:07:17 schrieb David Sterba:
> > > On Tue, Mar 17, 2015 at 02:33:30PM +0100, Martin Steigerwald wrote:
> > > > On BTRFS I see
> > > >
> > > > martin@merkaba:~> ls -lid /usr/local
> > > > 27138 drwxrwsr-x 1 root staff 62 Aug 15 2014 /usr/local
> > > > martin@merkaba:~> ls -lid /usr/local/.
> > > > 27138 drwxrwsr-x 1 root staff 62 Aug 15 2014 /usr/local/.
> > > > martin@merkaba:~> ls -lid /usr/local/bin/..
> > > > 27138 drwxrwsr-x 1 root staff 62 Aug 15 2014 /usr/local/bin/..
> > > >
> > > > On other filesystems like Ext4 I see the actual number of
> > > > hardlinks to
> > > > the directory.
> > > >
> > > > Is this intended behaviour of BTRFS or a bug?
> > >
> > > Intended behaviour, this has been asked in the past, I don't have
> > > the
> > > link sorry, try searching the mailinglist archives.
>
> http://thread.gmane.org/gmane.comp.file-systems.btrfs/14634
>
> "Directories always have a link count of 1 in btrfs. This tells find
> not to use the link count as the count of subdirectories in the
> directory."
>
> http://thread.gmane.org/gmane.comp.file-systems.btrfs/29906
>
> "As I understand it, inferring the number of directory entries from
> st_nlink is an optimization that isn't universally valid. If that
> count is 1, it must be considered invalid, and programs that don't
> handle this correctly are broken. Coreutils handle this, at least..."
Okay, thanks. That was before I subscribed to BTRFS mailinglist so not in
local mail archive.
It explains that having a correct hardlink number for directory is not
mandatory, but it doesn´t explain why BTRFS always has 1 in there instead
of the actual count of hardlinks. Is this an performance optimization for
BTRFS or are there any other reasons why BTRFS does it this way?
Thanks,
--
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA B82F 991B EAAC A599 84C7
next prev parent reply other threads:[~2015-03-18 14:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-17 13:33 number of hardlinks for directory in ls -lid always 1? Martin Steigerwald
2015-03-17 16:07 ` David Sterba
2015-03-18 13:31 ` Martin Steigerwald
2015-03-18 13:52 ` David Sterba
2015-03-18 14:23 ` Martin Steigerwald [this message]
2015-03-19 13:21 ` David Sterba
2015-03-19 21:47 ` Filipe David Manana
2015-03-19 23:02 ` Kai Krakow
2015-03-20 10:44 ` David Sterba
2015-03-20 12:39 ` David Sterba
2015-03-20 12:59 ` Filipe David Manana
2015-03-27 10:13 ` Martin Steigerwald
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7757761.93uGJVH8dW@merkaba \
--to=martin@lichtvoll.de \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).