X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=io_uring_engine.h;h=688a6ae9a6b9b2da7c37c166f1aa5d51bed7c8dd;hb=d45acc377040e80dc517dbdcbf3cfcb06eab8c09;hp=258d460d1219f03807fa114cf0485924b6c0ba94;hpb=3c481c94adcbd3d0aa3a9767129664d7253cf189;p=plocate diff --git a/io_uring_engine.h b/io_uring_engine.h index 258d460..688a6ae 100644 --- a/io_uring_engine.h +++ b/io_uring_engine.h @@ -18,11 +18,9 @@ public: IOUringEngine(size_t slop_bytes); void submit_read(int fd, size_t len, off_t offset, std::function cb); - // NOTE: We just do the stat() to get the data into the dentry cache for fast access; - // we don't care about the return value. Thus, the callback has no parameter lists. - // If we have no io_uring, the callback will be made immediately, with no stat() call - // being done. - void submit_stat(const char *path, std::function cb); + // NOTE: We just do the stat() to get the data into the dentry cache for fast access, + // or to check whether the file exists. Thus, the callback has only an OK/not OK boolean. + void submit_stat(const char *path, std::function cb); bool get_supports_stat() { return supports_stat; } void finish(); @@ -31,7 +29,7 @@ public: private: #ifndef WITHOUT_URING void submit_read_internal(io_uring_sqe *sqe, int fd, size_t len, off_t offset, std::function cb); - void submit_stat_internal(io_uring_sqe *sqe, char *path, std::function cb); + void submit_stat_internal(io_uring_sqe *sqe, char *path, std::function cb); io_uring ring; #endif @@ -49,7 +47,7 @@ private: struct QueuedStat { char *pathname; // Owned by us. - std::function cb; + std::function cb; }; std::queue queued_stats; @@ -60,7 +58,7 @@ private: Op op; std::function read_cb; - std::function stat_cb; + std::function stat_cb; union { struct { @@ -83,8 +81,4 @@ private: static constexpr size_t queue_depth = 256; }; -// A wrapper around pread() that returns an incomplete read. -// Always synchronous (no io_uring). -void complete_pread(int fd, void *ptr, size_t len, off_t offset); - #endif // !defined(IO_URING_ENGINE_H)