mm: add support for async page locking
authorJens Axboe <axboe@kernel.dk>
Fri, 22 May 2020 15:12:09 +0000 (09:12 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 26 May 2020 19:32:03 +0000 (13:32 -0600)
commita9d83b40e35fc46692f22eaa9e9f60c73c5d8b11
tree98129f17552b1989ba87a2237a4bd7dda808a930
parentbcc40d9f5efe174db4a4065addf2dc9fa67457f5
mm: add support for async page locking

Normally waiting for a page to become unlocked, or locking the page,
requires waiting for IO to complete. Add support for lock_page_async()
and wait_on_page_locked_async(), which are callback based instead. This
allows a caller to get notified when a page becomes unlocked, rather
than wait for it.

We add a new iocb field, ki_waitq, to pass in the necessary data for this
to happen. We can unionize this with ki_cookie, since that is only used
for polled IO. Polled IO can never co-exist with async callbacks, as it is
(by definition) polled completions. struct wait_page_key is made public,
and we define struct wait_page_async as the interface between the caller
and the core.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/fs.h
include/linux/pagemap.h
mm/filemap.c