Browse Source

mount: improve NFS directory listing (#7696)

mount: remove unused isEarlyTerminated variable

The variable was redundant because when processEachEntryFn returns false,
we immediately return fuse.OK, so the check was always false.
pull/7698/head
Chris Lu 1 week ago
committed by GitHub
parent
commit
1e1473ef4a
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      weed/mount/weedfs_dir_read.go

5
weed/mount/weedfs_dir_read.go

@ -159,7 +159,6 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl
} }
} }
isEarlyTerminated := false
dirPath, code := wfs.inodeToPath.GetPath(input.NodeId) dirPath, code := wfs.inodeToPath.GetPath(input.NodeId)
if code != fuse.OK { if code != fuse.OK {
return code return code
@ -179,13 +178,11 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl
if !isPlusMode { if !isPlusMode {
if !out.AddDirEntry(dirEntry) { if !out.AddDirEntry(dirEntry) {
isEarlyTerminated = true
return false return false
} }
} else { } else {
entryOut := out.AddDirLookupEntry(dirEntry) entryOut := out.AddDirLookupEntry(dirEntry)
if entryOut == nil { if entryOut == nil {
isEarlyTerminated = true
return false return false
} }
if fh, found := wfs.fhMap.FindFileHandle(inode); found { if fh, found := wfs.fhMap.FindFileHandle(inode); found {
@ -257,7 +254,6 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl
} }
// Cache exhausted, load next batch // Cache exhausted, load next batch
if !isEarlyTerminated {
if err := meta_cache.EnsureVisited(wfs.metaCache, wfs, dirPath); err != nil { if err := meta_cache.EnsureVisited(wfs.metaCache, wfs, dirPath); err != nil {
glog.Errorf("dir ReadDirAll %s: %v", dirPath, err) glog.Errorf("dir ReadDirAll %s: %v", dirPath, err)
return fuse.EIO return fuse.EIO
@ -287,7 +283,6 @@ func (wfs *WFS) doReadDirectory(input *fuse.ReadIn, out *fuse.DirEntryList, isPl
dh.isFinished = true dh.isFinished = true
} }
} }
}
return fuse.OK return fuse.OK
} }
Loading…
Cancel
Save