mirror of
https://github.com/minio/minio.git
synced 2025-01-27 06:33:18 -05:00
Improve du thread performance (#6849)
This commit is contained in:
parent
dd8c2aa5c6
commit
2a810c7da2
18
cmd/fs-v1.go
18
cmd/fs-v1.go
@ -187,14 +187,9 @@ func (fs *FSObjects) diskUsage(doneCh chan struct{}) {
|
|||||||
case <-doneCh:
|
case <-doneCh:
|
||||||
return errWalkAbort
|
return errWalkAbort
|
||||||
default:
|
default:
|
||||||
var fi os.FileInfo
|
fi, err := os.Stat(entry)
|
||||||
var err error
|
|
||||||
if hasSuffix(entry, slashSeparator) {
|
|
||||||
fi, err = fsStatDir(ctx, entry)
|
|
||||||
} else {
|
|
||||||
fi, err = fsStatFile(ctx, entry)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = osErrToFSFileErr(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
atomic.AddUint64(&fs.totalUsed, uint64(fi.Size()))
|
atomic.AddUint64(&fs.totalUsed, uint64(fi.Size()))
|
||||||
@ -226,14 +221,9 @@ func (fs *FSObjects) diskUsage(doneCh chan struct{}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var fi os.FileInfo
|
fi, err := os.Stat(entry)
|
||||||
var err error
|
|
||||||
if hasSuffix(entry, slashSeparator) {
|
|
||||||
fi, err = fsStatDir(ctx, entry)
|
|
||||||
} else {
|
|
||||||
fi, err = fsStatFile(ctx, entry)
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = osErrToFSFileErr(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
usage = usage + uint64(fi.Size())
|
usage = usage + uint64(fi.Size())
|
||||||
|
@ -83,8 +83,10 @@ func checkPathLength(pathName string) error {
|
|||||||
return errFileNameTooLong
|
return errFileNameTooLong
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert any '\' to '/'.
|
if runtime.GOOS == "windows" {
|
||||||
pathName = filepath.ToSlash(pathName)
|
// Convert any '\' to '/'.
|
||||||
|
pathName = filepath.ToSlash(pathName)
|
||||||
|
}
|
||||||
|
|
||||||
// Check each path segment length is > 255
|
// Check each path segment length is > 255
|
||||||
for len(pathName) > 0 && pathName != "." && pathName != "/" {
|
for len(pathName) > 0 && pathName != "." && pathName != "/" {
|
||||||
@ -374,6 +376,7 @@ func (s *posix) diskUsage(doneCh chan struct{}) {
|
|||||||
default:
|
default:
|
||||||
fi, err := os.Stat(entry)
|
fi, err := os.Stat(entry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = osErrToFSFileErr(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
atomic.AddUint64(&s.totalUsed, uint64(fi.Size()))
|
atomic.AddUint64(&s.totalUsed, uint64(fi.Size()))
|
||||||
@ -413,6 +416,7 @@ func (s *posix) diskUsage(doneCh chan struct{}) {
|
|||||||
default:
|
default:
|
||||||
fi, err := os.Stat(entry)
|
fi, err := os.Stat(entry)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
err = osErrToFSFileErr(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
usage = usage + uint64(fi.Size())
|
usage = usage + uint64(fi.Size())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user