linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: Add the nlink annotation in btrfs_inode_item
@ 2025-09-26  7:45 Youling Tang
  2025-09-26  8:34 ` Qu Wenruo
  0 siblings, 1 reply; 7+ messages in thread
From: Youling Tang @ 2025-09-26  7:45 UTC (permalink / raw)
  To: Chris Mason, Josef Bacik, David Sterba
  Cc: linux-btrfs, linux-kernel, youling.tang, Youling Tang

From: Youling Tang <tangyouling@kylinos.cn>

When I created a directory, I found that its hard link count was
1 (unlike other file system phenomena, including the "." directory,
which defaults to an initial count of 2).

By analyzing the code, it is found that the nlink of the directory
in btrfs has always been kept at 1, which is a deliberate design.

Adding its comments can prevent it from being mistakenly regarded
as a BUG.

Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
---
 include/uapi/linux/btrfs_tree.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
index fc29d273845d..b4f7da90fd0e 100644
--- a/include/uapi/linux/btrfs_tree.h
+++ b/include/uapi/linux/btrfs_tree.h
@@ -876,6 +876,7 @@ struct btrfs_inode_item {
 	__le64 size;
 	__le64 nbytes;
 	__le64 block_group;
+	/* nlink in directories is fixed at 1 */
 	__le32 nlink;
 	__le32 uid;
 	__le32 gid;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-09-28  8:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-26  7:45 [PATCH] btrfs: Add the nlink annotation in btrfs_inode_item Youling Tang
2025-09-26  8:34 ` Qu Wenruo
2025-09-28  2:14   ` Youling Tang
2025-09-28  5:16     ` Qu Wenruo
2025-09-28  7:09       ` Youling Tang
2025-09-28  7:37         ` Qu Wenruo
2025-09-28  8:35           ` Youling Tang

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).