From: David Sterba <dsterba@suse.cz>
To: Urs Thuermann <urs@isnogud.escape.de>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Link count for directories
Date: Mon, 31 Aug 2020 15:03:44 +0200 [thread overview]
Message-ID: <20200831130344.GW28318@twin.jikos.cz> (raw)
In-Reply-To: <ygfd03dkhvu.fsf@tehran.isnogud.escape.de>
On Wed, Aug 26, 2020 at 09:04:21AM +0200, Urs Thuermann wrote:
> > Find certainly paid attention, but from an optimization point of
> > view, dtype in directory entries is dramatically more helpful.
>
> 1. dtype is not in POSIX.
It is not but is this a problem in practice? Linux supports d_type and
that's what matters right now (manual page says that some BSDs support
that too).
> OTOH, I seem to remember that POSIX states
> st_link == 1 for directories or otherwise it has the traditional
> value of 2 + sub-directory count. However, I cannot find this
> anymore. Is that correct and can anyone give me a pointer?
I can't find a reliable source for that but I remember reading it
somewhere.
> 2. If you just want to find all directories you only need stat(2) on a
> directory and if it has st_nlink == 2 you don't need to read all
> directory entries (with or without dtype). So this optimization is
> possible with the traditional link count of directories but not
> with dtype.
>
> > I'd want to see big wins from applications before adding this
> > into btrfs.
>
> I would expect noticable but not big wins.
The usecasee you describe skips readdir in case there are no
directories, ie. if there are, full readdir will need to be done anyway.
I can see that this saves some calls but otherwise it's IMHO quite narrow.
> However, I'd like adding
> this to btrfs just because it looks nicer. Since ls (and readdir)
> gives you the . and .. links they should be counted in the usual way.
As said elsewhere, this comes with a cost of backward compatibility
issues and unfortunatelly overrides a 'nice to have' feature.
next prev parent reply other threads:[~2020-08-31 13: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
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 [this message]
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=20200831130344.GW28318@twin.jikos.cz \
--to=dsterba@suse.cz \
--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