From: Nikolay Borisov <nborisov@suse.com>
To: Urs Thuermann <urs@isnogud.escape.de>, linux-btrfs@vger.kernel.org
Subject: Re: Link count for directories
Date: Tue, 25 Aug 2020 15:38:05 +0300 [thread overview]
Message-ID: <32ebebd1-a84a-60bd-a156-a84a8f4377b9@suse.com> (raw)
In-Reply-To: <ygfwo1mq5fm.fsf@tehran.isnogud.escape.de>
On 25.08.20 г. 15:24 ч., Urs Thuermann wrote:
> 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.
It's slightly more complicated on btrfs because subvolumes and snapshots
are also directories from the POV of the user but are created in
different code paths. But that's the general idea.
>
> urs
>
next prev parent reply other threads:[~2020-08-25 12:38 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
2020-08-25 12:38 ` Nikolay Borisov [this message]
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=32ebebd1-a84a-60bd-a156-a84a8f4377b9@suse.com \
--to=nborisov@suse.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=urs@isnogud.escape.de \
/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