Skip to content

Commit

Permalink
cfs: Store dentries in chunks of max 4k and read as needed
Browse files Browse the repository at this point in the history
This changes the way a directory inode stores the dentry list.
Instead of a list of all dentries followed by all the filenames we
store a list of chunks, where each chunk is at most 4k of such
dentries and names. Additionally we have a header in the beginning
with the size and dentry count of all such chunks.

On the reader side we don't read (and alloc) all the dentries with the
inode, instead we read the blocks as needed, meaning we use a lot less
memory per in-memory inode.

We preload the chunk headers for typical size dirs (4 chunks max) as a
cheap way to avoid having to re-read it. However for large dirs we read
the table as needed.

Since we don't read all dentries when creating the inode we now also use
the st_nlink from the file rather than computing it from the dentries.

Signed-off-by: Alexander Larsson <[email protected]>
  • Loading branch information
alexlarsson committed Aug 10, 2022
1 parent 097fcb2 commit 884e6f2
Show file tree
Hide file tree
Showing 7 changed files with 565 additions and 212 deletions.
Loading

0 comments on commit 884e6f2

Please sign in to comment.