linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Filipe David Manana <fdmanana@gmail.com>
To: "dsterba@suse.cz" <dsterba@suse.cz>,
	Martin Steigerwald <martin@lichtvoll.de>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: number of hardlinks for directory in ls -lid always 1?
Date: Thu, 19 Mar 2015 21:47:15 +0000	[thread overview]
Message-ID: <CAL3q7H7A349PzQ=z+YGHukWNfG_Y8EyChZV6Tr944gYsgPf-_Q@mail.gmail.com> (raw)
In-Reply-To: <20150319132139.GE20767@twin.jikos.cz>

On Thu, Mar 19, 2015 at 1:21 PM, David Sterba <dsterba@suse.cz> wrote:
> On Wed, Mar 18, 2015 at 03:23:50PM +0100, Martin Steigerwald wrote:
>> 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?
>
> I believe it's for performance reasons. New inodes do not update the
> parent directory metadata wrt link counts, compared to other filesystems
> that do that.

Weird. Because creating a new inode implies adding the dentry to the
parent directory, which implies updating the directory's i_size.

>
> The real performance hit could be noticeable. The directory inode is
> cached in memory, so first update would be a bit slower, but the
> metadata block needs to be cow-ed on each new file. It's stress on
> b-tree locking and allocating new buffers for the metadata blocks.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

  reply	other threads:[~2015-03-19 21:47 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
2015-03-19 13:21         ` David Sterba
2015-03-19 21:47           ` Filipe David Manana [this message]
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='CAL3q7H7A349PzQ=z+YGHukWNfG_Y8EyChZV6Tr944gYsgPf-_Q@mail.gmail.com' \
    --to=fdmanana@gmail.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=martin@lichtvoll.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;
as well as URLs for NNTP newsgroup(s).