input/uring: new input plugin using io_uring

This is the final piece of the series to establish io_uring support on
Linux.

MPD doesn't need io_uring for its efficient bulk I/O support, but to
allow file I/O to be cancelled.  This is a big problem on CIFS/NFS
mounts where processes sleep uninterruptable if the file server
disappears, deadlocking MPD.

With io_uring, a flaky NFS connection allows MPD to continue to work
(even though there are still deadlocks inside MPD which need to be
addressed).

This plugin does not yet use cancellable `open()` using
`IORING_OP_OPENAT`.  This will be implemented later.

Lots of other optimization opportunities for io_uring are still
missing as well - for example the database update could benefit a lot,
but unfortunately, io_uring doesn't have `readdir()` support just yet.
This commit is contained in:
Max Kellermann
2020-05-05 15:32:41 +02:00
parent cdf8ac001c
commit dae8da7066
7 changed files with 265 additions and 0 deletions

View File

@@ -22,6 +22,11 @@
#include "plugins/FileInputPlugin.hxx"
#include "config.h"
#include "io/uring/Features.h"
#ifdef HAVE_URING
#include "plugins/UringInputPlugin.hxx"
#endif
#ifdef ENABLE_ARCHIVE
#include "plugins/ArchiveInputPlugin.hxx"
#endif
@@ -39,6 +44,12 @@ OpenLocalInputStream(Path path, Mutex &mutex)
#ifdef ENABLE_ARCHIVE
try {
#endif
#ifdef HAVE_URING
is = OpenUringInputStream(path.c_str(), mutex);
if (is)
return is;
#endif
is = OpenFileInputStream(path, mutex);
#ifdef ENABLE_ARCHIVE
} catch (const std::system_error &e) {