All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Borowski <kilobyte@angband.pl>
To: linux-btrfs@vger.kernel.org
Subject: Re: Link count for directories
Date: Tue, 25 Aug 2020 00:23:06 +0200	[thread overview]
Message-ID: <20200824222306.GA26736@angband.pl> (raw)
In-Reply-To: <trinity-963db523-ba60-48b5-997f-59b55ee6b92b-1598305830919@3c-app-gmx-bap63>

On Mon, Aug 24, 2020 at 11:50:30PM +0200, Steve Keller wrote:
> Nikolay Borisov <nborisov@suse.com> wrote:
> > I have implemented it so it's not that big of a deal. However turns out
> > it has pretty steep requirements for backport because so far btrfs
> > always kept the link count of dirs to 1.

> > So how effective is such an optimisation to the software using it ?
> 
> It's not only optimization like in find(1).  As an old and long-time Unix
> user I'd also like that traditional behavior.  It just feels more correct
> since if you do mkdir ./a ./b ./c ./d, you will actually see the 4 links
> to the current dir if you do ls -ai a b c d and the two links from . itself
> and from ..

It's just an implementation detail of sysvfs, and a case of
bug-compatibility.  The link count of a directory is always 1 as btrfs,
ext4, xfs, etc -- none of them support directory hardlinks, unlike sysvfs.

So the proper value, as documented, is 1.  Copying sysvfs behaviour is also
costly as you need to know the count of contents while statting parent.


Meow!
-- 
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁
⢿⡄⠘⠷⠚⠋⠀ It's time to migrate your Imaginary Protocol from version 4i to 6i.
⠈⠳⣄⠀⠀⠀⠀

  reply	other threads:[~2020-08-24 22:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21 17:40 Link count for directories Steve Keller
2020-08-24 12:44 ` Nikolay Borisov
2020-08-24 21:50   ` Steve Keller
2020-08-24 22:23     ` Adam Borowski [this message]
2020-08-25 12:24       ` Urs Thuermann
2020-08-25 12:38         ` Nikolay Borisov
2020-08-25 12:37       ` Nikolay Borisov
2020-08-25 13:46         ` Chris Mason
2020-08-26  7:04           ` Urs Thuermann
2020-08-31 13:03             ` David Sterba
2020-08-25 12:39     ` Nikolay Borisov
2020-08-31 13:18 ` David Sterba

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=20200824222306.GA26736@angband.pl \
    --to=kilobyte@angband.pl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.