mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
fix: fork os.MkdirAll to optimize cases where parent exists (#15379)
a/b/c/d/ where `a/b/c/` exists results in additional syscalls such as an Lstat() call to verify if the `a/b/c/` exists and its a directory. We do not need to do this on MinIO since the parent prefixes if exist, we can simply return success without spending additional syscalls. Also this implementation attempts to simply use Access() calls to avoid os.Stat() calls since the latter does memory allocation for things we do not need to use. Access() is simpler since we have a predictable structure on the backend and we know exactly how our path structures are.
This commit is contained in:
@@ -10,24 +10,25 @@ func _() {
|
||||
var x [1]struct{}
|
||||
_ = x[osMetricRemoveAll-0]
|
||||
_ = x[osMetricMkdirAll-1]
|
||||
_ = x[osMetricRename-2]
|
||||
_ = x[osMetricOpenFile-3]
|
||||
_ = x[osMetricOpen-4]
|
||||
_ = x[osMetricOpenFileDirectIO-5]
|
||||
_ = x[osMetricLstat-6]
|
||||
_ = x[osMetricRemove-7]
|
||||
_ = x[osMetricStat-8]
|
||||
_ = x[osMetricAccess-9]
|
||||
_ = x[osMetricCreate-10]
|
||||
_ = x[osMetricReadDirent-11]
|
||||
_ = x[osMetricFdatasync-12]
|
||||
_ = x[osMetricSync-13]
|
||||
_ = x[osMetricLast-14]
|
||||
_ = x[osMetricMkdir-2]
|
||||
_ = x[osMetricRename-3]
|
||||
_ = x[osMetricOpenFile-4]
|
||||
_ = x[osMetricOpen-5]
|
||||
_ = x[osMetricOpenFileDirectIO-6]
|
||||
_ = x[osMetricLstat-7]
|
||||
_ = x[osMetricRemove-8]
|
||||
_ = x[osMetricStat-9]
|
||||
_ = x[osMetricAccess-10]
|
||||
_ = x[osMetricCreate-11]
|
||||
_ = x[osMetricReadDirent-12]
|
||||
_ = x[osMetricFdatasync-13]
|
||||
_ = x[osMetricSync-14]
|
||||
_ = x[osMetricLast-15]
|
||||
}
|
||||
|
||||
const _osMetric_name = "RemoveAllMkdirAllRenameOpenFileOpenOpenFileDirectIOLstatRemoveStatAccessCreateReadDirentFdatasyncSyncLast"
|
||||
const _osMetric_name = "RemoveAllMkdirAllMkdirRenameOpenFileOpenOpenFileDirectIOLstatRemoveStatAccessCreateReadDirentFdatasyncSyncLast"
|
||||
|
||||
var _osMetric_index = [...]uint8{0, 9, 17, 23, 31, 35, 51, 56, 62, 66, 72, 78, 88, 97, 101, 105}
|
||||
var _osMetric_index = [...]uint8{0, 9, 17, 22, 28, 36, 40, 56, 61, 67, 71, 77, 83, 93, 102, 106, 110}
|
||||
|
||||
func (i osMetric) String() string {
|
||||
if i >= osMetric(len(_osMetric_index)-1) {
|
||||
|
||||
Reference in New Issue
Block a user