On Mon, Jul 08, 2024 at 09:35:25AM GMT, Hongbo Li wrote: > > > On 2024/7/6 12:11, Kent Overstreet wrote: > > On Fri, Jul 05, 2024 at 03:20:06PM GMT, Hongbo Li wrote: > > > The isize of directory is 0 in bcachefs if the directory is empty. > > > With more child dirents created, its size ought to change. Many > > > other filesystems changed as that (ie. xfs and btrfs). And many of > > > them changed as the size of child dirent name. Although the directory > > > size may not seem to convey much, we can still give it some meaning. > > > > > > The formula of dentry size as follow: > > > occupied_size = 40 + ALIGN(9 + namelen, 8) > > > > > > Signed-off-by: Hongbo Li <lihongbo22@xxxxxxxxxx> > > > > I like it. > > > > It's going to need more work though; it'll be a new on disk format > > version, and fsck needs to know how to sum up dirents and check i_size - > > which won't be bad, since we already have to sum up child directories > > for i_nlink. > > Yeah, more effort is needed. This is just an RFC, and I will refine this > patch later. Sounds good. This is also one one we'll want to CC to fsdevel and see if any other filesystems have interesting to say on i_size for directories.