Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subdirectories do not increment parent directory's link count #4

Open
dsheets opened this issue Oct 3, 2015 · 0 comments
Open

Subdirectories do not increment parent directory's link count #4

dsheets opened this issue Oct 3, 2015 · 0 comments

Comments

@dsheets
Copy link

dsheets commented Oct 3, 2015

When a subdirectory is created, the parent directory's link count increases by 1 (for ..) on typical POSIX-like file systems. Using 27c4078, a directory's link count remains 2 when subdirectories are created:

# mkdir foo
# stat foo
  File: ‘foo’
  Size: 4096        Blocks: 1          IO Block: 4096   directory
Device: 29h/41d Inode: 8           Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 1970-01-01 01:00:00.000000000 +0100
Modify: 1970-01-01 01:00:00.000000000 +0100
Change: 1970-01-01 01:00:00.000000000 +0100
 Birth: -
# mkdir foo/bar
# stat foo
  File: ‘foo’
  Size: 4096        Blocks: 1          IO Block: 4096   directory
Device: 29h/41d Inode: 8           Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 1970-01-01 01:00:00.000000000 +0100
Modify: 1970-01-01 01:00:00.000000000 +0100
Change: 1970-01-01 01:00:00.000000000 +0100
 Birth: -

While many POSIX foreign file systems do not obey directory link count invariants, it can be useful for programs (e.g. find) which perform many directory traversals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant