mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 16:28:15 +00:00
perf: avoid blocking hop for owned disk writes (#3004)
* perf: avoid blocking hop for owned disk writes * fix(ecstore): sync owned write path
This commit is contained in:
@@ -1179,14 +1179,9 @@ impl LocalDisk {
|
||||
f.write_all(buf).await.map_err(to_file_error)?;
|
||||
}
|
||||
InternalBuf::Owned(buf) => {
|
||||
// Reduce one copy by using the owned buffer directly.
|
||||
// It may be more efficient for larger writes.
|
||||
let mut f = f.into_std().await;
|
||||
let task = tokio::task::spawn_blocking(move || {
|
||||
use std::io::Write as _;
|
||||
f.write_all(buf.as_ref()).map_err(to_file_error)
|
||||
});
|
||||
task.await??;
|
||||
f.write_all(buf.as_ref()).await.map_err(to_file_error)?;
|
||||
// Ensure write errors are observed before returning for owned buffers.
|
||||
f.sync_all().await.map_err(to_file_error)?;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user