diff --git a/ircd/aio.cc b/ircd/aio.cc index 1a1080764..23409f148 100644 --- a/ircd/aio.cc +++ b/ircd/aio.cc @@ -148,6 +148,18 @@ ircd::fs::write__aio(const fd &fd, return view; } +// +// request::prefetch +// + +void +ircd::fs::prefetch__aio(const fd &fd, + const size_t &size, + const read_opts &opts) +{ + +} + // // aio // diff --git a/ircd/aio.h b/ircd/aio.h index 0ad3422c8..3f545c90c 100644 --- a/ircd/aio.h +++ b/ircd/aio.h @@ -76,6 +76,7 @@ struct ircd::fs::aio::request namespace ircd::fs { + void prefetch__aio(const fd &, const size_t &, const read_opts &); const_buffer write__aio(const fd &, const const_buffer &, const write_opts &); const_buffer read__aio(const fd &, const mutable_buffer &, const read_opts &); void fdsync__aio(const fd &, const fsync_opts &); diff --git a/ircd/fs.cc b/ircd/fs.cc index b82b6081f..6591a029f 100644 --- a/ircd/fs.cc +++ b/ircd/fs.cc @@ -237,10 +237,16 @@ ircd::fs::prefetch(const fd &fd, syscall(::fcntl, fd, F_GETFL) }; - if(flags & O_DIRECT) - return; //TODO: AIO prefetch scheme + if(~flags & O_DIRECT) + { + syscall(::readahead, fd, opts.offset, count); + return; + } - syscall(::readahead, fd, opts.offset, count); + #ifdef IRCD_USE_AIO + if(likely(aioctx)) + prefetch__aio(fd, count, opts); + #endif } #else void