[PATCH v2 0/2] fs: btrfs: add support for readdir
Alexey Charkov
alchark at flipper.net
Fri Jun 26 17:18:20 CEST 2026
Btrfs in U-boot currently uses a custom callback for ls and doesn't expose
the standard opendir/readdir/closedir interface, making it harder to use
in generic code. One area where this would be useful is in discovering BLS
type 1 entries [1] on a Btrfs filesystem.
Add support for the standard interface, and implement ls in terms of it.
[1] https://lore.kernel.org/u-boot/20260604-bls-v1-0-4ce6d1ee4711@flipper.net/
Signed-off-by: Alexey Charkov <alchark at flipper.net>
---
Changes in v2:
- Cache subvolume id and inode number instead of looking them up on every
readdir call (thanks Qu)
- Split out the dirent type conversion between btrfs and U-Boot filesystem
convention into a helper function (thanks Qu)
- Drop redundant check for XATTR entries in btrfs_next_dir_entry (thanks Qu)
- Remove btrfs_ls and show_dir which nothing calls after the second patch
- Use container_of instead of type-casting struct pointers
- Link to v1: https://patch.msgid.link/20260625-btrfs-readdir-v1-0-dd781a2b3965@flipper.net
To: Qu Wenruo <wqu at suse.com>
To: linux-btrfs at vger.kernel.org
To: u-boot at lists.denx.de
Cc: Marek Behún <kabel at kernel.org>
Cc: Tom Rini <trini at konsulko.com>
Cc: Alexey Charkov <alchark at flipper.net>
Cc: Peng Fan <peng.fan at nxp.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Timo tp Preißl <t.preissl at proton.me>
Cc: Patrice Chotard <patrice.chotard at foss.st.com>
Cc: Yao Zi <me at ziyao.cc>
---
Alexey Charkov (2):
fs: btrfs: implement opendir(), readdir() and closedir()
fs: btrfs: use fs_ls_generic() and drop custom implementation
fs/btrfs/btrfs.c | 199 ++++++++++++++++++++++------------------------------
fs/btrfs/ctree.h | 7 +-
fs/btrfs/dir-item.c | 76 ++++++++++++--------
fs/fs.c | 6 +-
include/btrfs.h | 6 +-
5 files changed, 143 insertions(+), 151 deletions(-)
---
base-commit: 19eafbadf20f56c1a24abe6b5e8774e776894261
change-id: 20260625-btrfs-readdir-8beac3ac5220
Best regards,
--
Alexey Charkov <alchark at flipper.net>
More information about the U-Boot
mailing list