[PATCH v2 0/2] fs: btrfs: add support for readdir

Alexey Charkov <[email protected]>
Newsgroups org.kernel.vger.linux-btrfs,org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
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/[email protected]/

Signed-off-by: Alexey Charkov <[email protected]>
---
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/[email protected]

To: Qu Wenruo <[email protected]>
To: [email protected]
To: [email protected]
Cc: Marek Behún <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Alexey Charkov <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Timo tp Preißl <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Yao Zi <[email protected]>

---
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 <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.