All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Steve Keller <keller.steve@gmx.de>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: Link count for directories
Date: Mon, 31 Aug 2020 15:18:25 +0200	[thread overview]
Message-ID: <20200831131825.GX28318@twin.jikos.cz> (raw)
In-Reply-To: <trinity-57be0daf-2aa0-4480-a962-7a62e302cfde-1598031619031@3c-app-gmx-bap35>

On Fri, Aug 21, 2020 at 07:40:19PM +0200, Steve Keller wrote:
> Are there any plans to implement the traditional link count behavior in btrfs,
> as described in the following URL?
> 
> https://btrfs.wiki.kernel.org/index.php/Project_ideas#Track_link_count_for_directories
> 
> Would it be a major effort to do so?  I'd really like that feature.

So the main concern is backward compatibility and what would happen if a
filesystem with nlink tracking gets mounted by a kernel without the
support. The wiki project entry seems to be too optimistic regarding
that (and I think it was me adding it there):

  It seems that the link count can be tracked like the other filesystems
  do. This will be even backward compatible:

  * for new directories and subvolumes , set the initial link count to 2
  * a mkdir/rmdir/move/snapshot will update the link count accordingly
    iff the current link count is not 1

Bad scenario:

* new kernel creates directory with many sudirectories, with nlink eg 100
* reboot to an older kernel
* delete some of the subdirectories, nlink untouched and silently out of
  sync
* reboot to new kernel
* creating more subdirectories will not fix nlink, only add the new
  entries, and deletion can go below zero (though it would stay stop at
  1)

This does not sound unrealistic to me, eg booting a new kernel after
update and then going back because some random driver does not work.
All the directories created meanwhile will be affected.

Usually such incompatibilies are shielded by incompat bits but in this
case it sounds like a too heavy measure for a minor performance
optimization.

I'll move the project idea away with explanation why it's not
implemented.

      parent reply	other threads:[~2020-08-31 13:19 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
2020-08-25 12:39     ` Nikolay Borisov
2020-08-31 13:18 ` David Sterba [this message]

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=20200831131825.GX28318@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=keller.steve@gmx.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 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.