public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Urs Thuermann <urs@isnogud.escape.de>
To: linux-btrfs@vger.kernel.org
Subject: Re: Link count for directories
Date: 25 Aug 2020 14:24:29 +0200	[thread overview]
Message-ID: <ygfwo1mq5fm.fsf@tehran.isnogud.escape.de> (raw)
In-Reply-To: <20200824222306.GA26736@angband.pl>; from Adam Borowski on Tue, 25 Aug 2020 00:23:06 +0200

Adam Borowski <kilobyte@angband.pl> writes:

> 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.

No, allmost all other file systems handle the directory link count in
the traditional way, at least minix, ext2, ext3, ext4, xfs, tmpfs,
devtmpfs, devpts, sysfs, cgroup on Linux do so.  And also FreeBSD ufs
and devfs, NetBSD ffs, tmpfs, and kernfs, and OpenBSD ffs and mfs do
that also.

I'd like to check how zfs handles this (on Linux, FreeBSD or Solaris),
but currently have no access to a system using it.

> 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.

No, it's not that costly.  Directories start with nlink = 2 and nlinks
is incremented or decremented with each mkdir or rmdir system call.

urs

  reply	other threads:[~2020-08-25 12:29 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
2020-08-25 12:24       ` Urs Thuermann [this message]
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=ygfwo1mq5fm.fsf@tehran.isnogud.escape.de \
    --to=urs@isnogud.escape.de \
    --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