]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bcachefs: make directory i_size meaningful
authorHongbo Li <lihongbo22@huawei.com>
Tue, 7 Jan 2025 13:18:40 +0000 (13:18 +0000)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 13 Jan 2025 19:58:38 +0000 (14:58 -0500)
commite614a6c52d32c9c7ff545ca842eb2de4aeb1d2d9
tree1846f383297edaff949c804aeaa248ebde263dfa
parent4204e3bf63c4b68968fd557f05fed32c99e2b18a
bcachefs: make directory i_size meaningful

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@huawei.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/dirent.h
fs/bcachefs/fs-common.c
fs/bcachefs/fs.c