mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
turn-off Nlink readdir() optimization for NFS/CIFS (#19420)
fixes #19418 fixes #19416
This commit is contained in:
@@ -59,10 +59,22 @@ type WalkDirOptions struct {
|
||||
DiskID string
|
||||
}
|
||||
|
||||
// supported FS for Nlink optimization in readdir.
|
||||
const (
|
||||
xfs = "XFS"
|
||||
ext4 = "EXT4"
|
||||
)
|
||||
|
||||
// WalkDir will traverse a directory and return all entries found.
|
||||
// On success a sorted meta cache stream will be returned.
|
||||
// Metadata has data stripped, if any.
|
||||
func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writer) (err error) {
|
||||
legacyFS := !(s.fsType == xfs || s.fsType == ext4)
|
||||
|
||||
s.RLock()
|
||||
legacy := s.formatLegacy
|
||||
s.RUnlock()
|
||||
|
||||
// Verify if volume is valid and it exists.
|
||||
volumeDir, err := s.getVolDir(opts.Bucket)
|
||||
if err != nil {
|
||||
@@ -76,10 +88,6 @@ func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writ
|
||||
}
|
||||
}
|
||||
|
||||
s.RLock()
|
||||
legacy := s.formatLegacy
|
||||
s.RUnlock()
|
||||
|
||||
// Use a small block size to start sending quickly
|
||||
w := newMetacacheWriter(wr, 16<<10)
|
||||
w.reuseBlocks = true // We are not sharing results, so reuse buffers.
|
||||
@@ -353,7 +361,7 @@ func (s *xlStorage) WalkDir(ctx context.Context, opts WalkDirOptions, wr io.Writ
|
||||
// NOT an object, append to stack (with slash)
|
||||
// If dirObject, but no metadata (which is unexpected) we skip it.
|
||||
if !isDirObj {
|
||||
if !isDirEmpty(pathJoinBuf(sb, volumeDir, meta.name)) {
|
||||
if !isDirEmpty(pathJoinBuf(sb, volumeDir, meta.name), legacyFS) {
|
||||
dirStack = append(dirStack, meta.name+slashSeparator)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user