posix: Fix windows performance issues. (#3132)

Do not attempt to fetch volume/drive information for
each i/o situation. In our case we do this in all calls
`posix.go` this in-turn created a terrible situation for
windows. This issue does not affect the i/o path on Unix
platforms since statvfs calls are in the range of micro
seconds on these platforms.

This verification is only needed during startup and we
let things fail at a later stage on windows.
This commit is contained in:
Harshavardhana
2016-10-31 09:34:44 -07:00
committed by GitHub
parent a773a6dce6
commit f3c6c55719
6 changed files with 160 additions and 78 deletions

View File

@@ -42,7 +42,7 @@ func isSysErrIO(err error) bool {
return err != nil && err == syscall.EIO
}
// Check if the given error corresponds to ENOTDIR (is not a directory)
// Check if the given error corresponds to ENOTDIR (is not a directory).
func isSysErrNotDir(err error) bool {
if pathErr, ok := err.(*os.PathError); ok {
switch pathErr.Err {
@@ -53,8 +53,19 @@ func isSysErrNotDir(err error) bool {
return false
}
// Check if the given error corresponds to the ENAMETOOLONG (name too long).
func isSysErrTooLong(err error) bool {
if pathErr, ok := err.(*os.PathError); ok {
switch pathErr.Err {
case syscall.ENAMETOOLONG:
return true
}
}
return false
}
// Check if the given error corresponds to ENOTEMPTY for unix
// and ERROR_DIR_NOT_EMPTY for windows (directory not empty)
// and ERROR_DIR_NOT_EMPTY for windows (directory not empty).
func isSysErrNotEmpty(err error) bool {
if pathErr, ok := err.(*os.PathError); ok {
if runtime.GOOS == "windows" {