[RFC 0/5] implement asynchronous BLKDISCARD via io_uring

Pavel Begunkov
2024-08-14T10:45:26Z

There is an interest in having asynchronous block operations like
discard. The patch set implements that as io_uring commands, which is
an io_uring request type allowing to implement custom file specific
operations.

First 4 patches are simple preps, and the main part is in Patch 5.
Not tested with a real drive yet, hence sending as an RFC.

I'm also going to add BLKDISCARDZEROES and BLKSECDISCARD, which should
reuse structures and helpers from Patch 5.

liburing tests for reference:

https://github.com/isilence/liburing.git discard-cmd-test

Pavel Begunkov (5):
io_uring/cmd: expose iowq to cmds
io_uring/cmd: give inline space in request to cmds
filemap: introduce filemap_invalidate_pages
block: introduce blk_validate_discard()
block: implement io_uring discard cmd

block/blk.h | 1 +
block/fops.c | 2 +
block/ioctl.c | 139 ++++++++++++++++++++++++++++++-----
include/linux/io_uring/cmd.h | 15 ++++
include/linux/pagemap.h | 2 +
include/uapi/linux/fs.h | 2 +
io_uring/io_uring.c | 11 +++
io_uring/io_uring.h | 1 +
io_uring/uring_cmd.c | 7 ++
mm/filemap.c | 18 +++--
10 files changed, 176 insertions(+), 22 deletions(-)

--
2.45.2