On 8/22/24 07:50, Christoph Hellwig wrote:
On Thu, Aug 22, 2024 at 04:35:56AM +0100, Pavel Begunkov wrote:
Add another io_uring cmd for block layer implementing asynchronous write
zeroes. It reuses helpers we've added for async discards, and inherits
the code structure as well as all considerations in regards to page
cache races.
Most comments from discard apply here as well.
+static int blkdev_queue_cmd(struct io_uring_cmd *cmd, struct block_device *bdev,
+ uint64_t start, uint64_t len, sector_t limit,
+ blk_opf_t opf)
This feels a little over generic as it doesn't just queue any random
command.
+static int blkdev_cmd_write_zeroes(struct io_uring_cmd *cmd,
+ struct block_device *bdev,
+ uint64_t start, uint64_t len, bool nowait)
+{
+ blk_opf_t opf = REQ_OP_WRITE_ZEROES | REQ_NOUNMAP;
+
+ if (nowait)
+ opf |= REQ_NOWAIT;
+ return blkdev_queue_cmd(cmd, bdev, start, len,
+ bdev_write_zeroes_sectors(bdev), opf);
So no support for fallback to Write of zero page here? That's probably
the case where the async offload is needed most.
Fair enough, but I believe it's more reasonable to have a separate
cmd for it instead of silently falling back.
--
Pavel Begunkov