mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-20 11:32:19 +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)?;
|
f.write_all(buf).await.map_err(to_file_error)?;
|
||||||
}
|
}
|
||||||
InternalBuf::Owned(buf) => {
|
InternalBuf::Owned(buf) => {
|
||||||
// Reduce one copy by using the owned buffer directly.
|
f.write_all(buf.as_ref()).await.map_err(to_file_error)?;
|
||||||
// It may be more efficient for larger writes.
|
// Ensure write errors are observed before returning for owned buffers.
|
||||||
let mut f = f.into_std().await;
|
f.sync_all().await.map_err(to_file_error)?;
|
||||||
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??;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user