[PATCH 21/21] Make root directory of file system have nlink of 2

Valerie Aurora val at versity.com
Tue Feb 11 13:19:18 PST 2025


Other file systems give the root directory an nlink of 2 for . and ..,
so follow the convention.

Signed-off-by: Valerie Aurora <val at versity.com>
---
 shared/mkfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/shared/mkfs.c b/shared/mkfs.c
index ca174b9..dee8cbe 100644
--- a/shared/mkfs.c
+++ b/shared/mkfs.c
@@ -26,7 +26,7 @@ int ngnfs_mkfs(struct ngnfs_fs_info *nfi)
 
 	do {
 		ret = ngnfs_inode_get(nfi, &txn, NBF_WRITE, NGNFS_ROOT_INO, &itref)		?:
-		      ngnfs_inode_init(&itref, NGNFS_ROOT_INO, 1, 1, S_IFDIR | 0755, nsec);
+		      ngnfs_inode_init(&itref, NGNFS_ROOT_INO, 1, 2, S_IFDIR | 0755, nsec);
 
 	} while (ngnfs_txn_retry(nfi, &txn, &ret));
 
-- 
2.48.1




More information about the ngnfs-devel mailing list