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. > +struct bio *blk_alloc_write_zeroes_bio(struct block_device *bdev, > + sector_t *sector, sector_t *nr_sects, > + gfp_t gfp_mask); Please keep this in block/blk.h, no need to expose it to the entire kernel.