pull/3501/merge
Darren Yu 2 weeks ago committed by GitHub
commit b9e48b317f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -226,6 +226,12 @@ func (handler *Driver) Token(ctx context.Context, uploadSession *fs.UploadSessio
if err := Fallocate(f, 0, uploadSession.Props.Size); err != nil {
handler.l.Warning("Failed to preallocate file: %s", err)
}
} else {
// When disk pre-allocation is disabled, concurrent chunk uploads must be 1
// to avoid disk fragmentation and write contention on local storage.
settings := *handler.Policy.Settings
settings.ChunkConcurrency = 1
handler.Policy.Settings = &settings
}
return &fs.UploadCredential{

@ -150,6 +150,14 @@ func (handler *Driver) Token(ctx context.Context, uploadSession *fs.UploadSessio
return nil, fmt.Errorf("failed to sign upload url: %w", err)
}
// When disk pre-allocation is disabled, concurrent chunk uploads must be 1
// to avoid disk fragmentation and write contention on slave storage.
if !handler.Policy.Settings.PreAllocate {
settings := *handler.Policy.Settings
settings.ChunkConcurrency = 1
handler.Policy.Settings = &settings
}
return &fs.UploadCredential{
SessionID: uploadSession.Props.UploadSessionID,
ChunkSize: handler.Policy.Settings.ChunkSize,

Loading…
Cancel
Save