diff options
| author | Cole Munz <[email protected]> | 2026-08-02 09:35:19 +0000 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-08-10 12:38:57 -0600 |
| commit | 1cf825afd0d7ebb4857002833658574efbef6626 (patch) | |
| tree | 2ed9a49b3a75e90077e8ad925bce19a9a4a1db56 /scripts/Kbuild.include | |
| parent | baa64b2f892890f00a377eac4a3e685472bb56b5 (diff) | |
fs: btrfs: report file sizes from readdir
btrfs_readdir() zeroes the dirent and fills in only the name and the
type, so dent->size stays 0 and every file is listed as zero bytes:
=> ls host 0 /
0 f_192k.bin
0 small_3k.bin
Reads themselves are fine, since btrfs_read() takes the size from
btrfs_size(), which does its own inode item lookup. It affects EFI
too: dir_read() in lib/efi_loader/efi_file.c copies dent->size into
both file_size and physical_size, so an EFI application enumerating a
directory on btrfs sees every file as empty, which is the generic-code
path Alexey's readdir series moves btrfs onto.
The custom listing that fs_ls_generic() replaced looked the inode item
up and printed the real size, and every other filesystem in the tree
fills dent->size in its own readdir: ext4fs.c:327, exfat io.c:805,
erofs fs.c:186, squashfs sqfs.c:1095 and fat.c:1555.
btrfs_next_dir_entry() already has the dir item mapped, so read the
key it points at while we are there and hand it back to the caller,
and use that to reach the inode item. A subvolume entry points at a
root item instead and has no size of its own, so leave that one at 0.
=> ls host 0 /
196608 f_192k.bin
3000 small_3k.bin
Fixes: 31cf3f177823 ("fs: btrfs: use fs_ls_generic() and drop custom implementation")
Signed-off-by: Cole Munz <[email protected]>
Reviewed-by: Qu Wenruo <[email protected]>
Diffstat (limited to 'scripts/Kbuild.include')
0 files changed, 0 insertions, 0 deletions
