ref: 40ad4e69f1c70b8152c095fee65d37d03e248e24
parent: e74ed1deb8aeb00b24335348e7cd75d0d87201cc
author: Alex Musolino <alex@musolino.id.au>
date: Wed Jan 4 09:59:42 EST 2023
make ReadDirAll more efficient
--- a/mntgen.go
+++ b/mntgen.go
@@ -60,14 +60,12 @@
}
func (d *Dir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
- var entries []fuse.Dirent
- for k, v := range d.Entries {
- var a fuse.Attr
- v.Attr(ctx, &a)
+ entries := make([]fuse.Dirent, 0, len(d.Entries))
+ for name, entry := range d.Entries {
entries = append(entries, fuse.Dirent{
- Inode: a.Inode,
+ Inode: entry.Attributes.Inode,
Type: fuse.DT_Dir,
- Name: k,
+ Name: name,
})
}
return entries, nil