diff options
| author | chrislu <chris.lu@gmail.com> | 2022-02-15 22:42:10 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-02-15 22:42:10 -0800 |
| commit | 3cbce878f2c658c197c15eb36c63551ec1da2b44 (patch) | |
| tree | aec7429e3034df2f727af93baffee87768e5d3f3 /weed/mount/weedfs_dir_read.go | |
| parent | df51e0c042c1b5fe6ef62f3eafdcc3b9961d0ee3 (diff) | |
| download | seaweedfs-3cbce878f2c658c197c15eb36c63551ec1da2b44.tar.xz seaweedfs-3cbce878f2c658c197c15eb36c63551ec1da2b44.zip | |
mount2: fix directory pagination
Diffstat (limited to 'weed/mount/weedfs_dir_read.go')
| -rw-r--r-- | weed/mount/weedfs_dir_read.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/weed/mount/weedfs_dir_read.go b/weed/mount/weedfs_dir_read.go index 99882fcf8..008146773 100644 --- a/weed/mount/weedfs_dir_read.go +++ b/weed/mount/weedfs_dir_read.go @@ -16,7 +16,6 @@ type DirectoryHandleId uint64 type DirectoryHandle struct { isFinished bool - counter uint32 lastEntryName string } @@ -139,17 +138,16 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl return fuse.OK } + isEarlyTerminated := false dirPath := wfs.inodeToPath.GetPath(input.NodeId) var dirEntry fuse.DirEntry if input.Offset == 0 && !isPlusMode { - dh.counter++ dirEntry.Ino = input.NodeId dirEntry.Name = "." dirEntry.Mode = toSystemMode(os.ModeDir) out.AddDirEntry(dirEntry) - dh.counter++ parentDir, _ := dirPath.DirAndName() parentInode := wfs.inodeToPath.GetInode(util.FullPath(parentDir)) dirEntry.Ino = parentInode @@ -160,18 +158,19 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl } processEachEntryFn := func(entry *filer.Entry, isLast bool) bool { - dh.counter++ dirEntry.Name = entry.Name() inode := wfs.inodeToPath.GetInode(dirPath.Child(dirEntry.Name)) dirEntry.Ino = inode dirEntry.Mode = toSystemMode(entry.Mode) if !isPlusMode { if !out.AddDirEntry(dirEntry) { + isEarlyTerminated = true return false } } else { entryOut := out.AddDirLookupEntry(dirEntry) if entryOut == nil { + isEarlyTerminated = true return false } wfs.outputFilerEntry(entryOut, inode, entry) @@ -191,7 +190,7 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl glog.Errorf("list meta cache: %v", listErr) return fuse.EIO } - if dh.counter < input.Length { + if !isEarlyTerminated { dh.isFinished = true } |
