All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Franklin, Jason" <jason.franklin@quoininc.com>
To: linux-btrfs@vger.kernel.org
Subject: Hard link count reported by "ls -l" is wrong
Date: Tue, 25 Feb 2020 09:59:49 -0500	[thread overview]
Message-ID: <051c9f6d-5765-e2d1-9aae-aff70e0f2bb4@quoininc.com> (raw)

Greetings:

I'm using btrfs on Debian 10.

When using "ls -l" to view a detailed listing in the current directory,
I get output similar to the following:

total 0
drwxrwx--- 1 jfrankli jfrankli  38 Feb 25 09:54 Desktop/
drwxrwx--- 1 jfrankli jfrankli  36 Jan 24 10:37 Documents/
drwxrwx--- 1 jfrankli jfrankli 612 Feb 24 15:48 Downloads/
drwxrwx--- 1 jfrankli jfrankli   0 Nov  6 04:44 Music/
drwxrwx--- 1 jfrankli jfrankli  20 Nov  6 04:44 Pictures/
drwxrwx--- 1 jfrankli jfrankli   0 Nov  6 04:44 Public/
drwxrwx--- 1 jfrankli jfrankli   0 Dec 27 20:20 Templates/
drwxrwx--- 1 jfrankli jfrankli   0 Dec 27 20:20 Videos/
drwxrwx--- 1 jfrankli jfrankli 522 Nov 26 09:53 bin/
drwxrwx--- 1 jfrankli jfrankli  28 Dec 27 15:23 snap/

Notice that these are all directories with a hard link count of "1".

I have always seen directories possessing a hard link count of "2" or
greater.  This is because the directory itself is a hard link, and it
also contains the "." entry (the second hard link).

Any immediate child directory of a directory also adds +1 to the hard
link count on other file systems.  This is because each child directory
contains the ".." hard link pointing to its parent directory.

Why does this not happen with btrfs?

Could it a bug with the GNU "ls" tool?

-- 
Jason Franklin

             reply	other threads:[~2020-02-25 14:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 14:59 Franklin, Jason [this message]
2020-02-25 15:59 ` Hard link count reported by "ls -l" is wrong Adam Borowski
2020-02-25 16:00 ` David Sterba
2020-02-26  0:25 ` Qu Wenruo

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=051c9f6d-5765-e2d1-9aae-aff70e0f2bb4@quoininc.com \
    --to=jason.franklin@quoininc.com \
    --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.