-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
We have recently invested a lot of time in rewriting FileStream on Windows. We have kept io_uring in mind and after recent refactoring, it should be now much easier to implement the support:
- we have introduced a new internal abstraction called FileStreamStrategy. It's more or less
FileStreamAPI. FileStreamcan choose the strategy at runtime. In the case ofLinux, it could detect the kernel version and just use the new strategy for newer kernels (5.5+). It means that the day our customers update their kernel version, .NET could start usingio_uringwithout a .NET update.- Entire buffering logic has been moved to a new strategy called BufferedFileStreamStrategy which can be used as a wrapper over another strategy. It means that new strategies (like
IoUringStrategy) don't need to worry about buffering at all
runtime/src/libraries/System.Private.CoreLib/src/System/IO/Strategies/FileStreamHelpers.Windows.cs
Lines 59 to 60 in 2223bab
internal static FileStreamStrategy EnableBufferingIfNeeded(WindowsFileStreamStrategy strategy, int bufferSize) => bufferSize == 1 ? strategy : new BufferedFileStreamStrategy(strategy, bufferSize); - We can use the existing Unix strategy for sync file IO, so the new
IoUringStrategywould only need to implementReadAsyncandWriteAsyncsupport.
We (owners of System.IO) have a lot of other high-priority things on our schedule for .NET 6 (like full symbolic links support) and since most of our customers are not using the latest Linux kernels, we are most probably won't be able to implement it on our own for .NET 6. But we would love to provide any help necessary (code reviews, testing) for a contributor that would be willing to implement it. Having said that, I am marking this issue as "up-for-grabs".
If we won't find a contributor for .NET 6, we are going to include this in .NET 7 planning and deliver it in .NET 7.