On Tue, Sep 10, 2024 at 01:17:48PM +0100, Pavel Begunkov wrote: > > > Add a command that writes the zero page to the drive. Apart from passing > > > the zero page instead of actual data it uses the normal write path and > > > doesn't do any further acceleration, nor it requires any special > > > hardware support. The indended use is to have a fallback when > > > BLOCK_URING_CMD_WRITE_ZEROES is not supported. > > > > That's just a horrible API. The user should not have to care if the > > kernel is using different kinds of implementations. > > It's rather not a good api when instead of issuing a presumably low > overhead fast command the user expects sending a good bunch of actual > writes with different performance characteristics. The normal use case (at least the ones I've been involved with) are simply zero these blocks or the entire device, and please do it as good as you can. Needing asynchronous error handling in userspace for that is extremely counter productive. > In my experience, > such fallbacks cause more pain when a more explicit approach is > possible. And let me note that it's already exposed via fallocate, even > though in a bit different way. Do you mean the FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE case in blkdev_fallocate? As far as I can tell this is actually a really bad example, as even a hardware offloaded write zeroes can and often does write physical zeroes to the media, and does so from a firmware path that is often slower than the kernel loop. But you have an actual use case where you want to send a write zeroes command but never a loop of writes, it would be good to document that and add a flag for it. And if we don't have that case it would still be good to have a reserved flags field to add it later if needed. Btw, do you have API documentation (e.g. in the form of a man page) for these new calls somewhere?