Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix O_DIRECT and multi-threaded io_context issues #621

Merged
merged 10 commits into from
Apr 17, 2024
4 changes: 2 additions & 2 deletions src/clockcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1687,7 +1687,7 @@ void
clockcache_flush(clockcache *cc)
{
// make sure all aio is complete first
io_cleanup_all(cc->io);
io_wait_all(cc->io);

// there can be no references or pins or things won't flush
// clockcache_assert_no_locks_held(cc); // take out for performance
Expand All @@ -1701,7 +1701,7 @@ clockcache_flush(clockcache *cc)
}

// make sure all aio is complete again
io_cleanup_all(cc->io);
io_wait_all(cc->io);

debug_assert(clockcache_assert_clean(cc));
}
Expand Down
16 changes: 4 additions & 12 deletions src/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ typedef platform_status (*io_write_async_fn)(io_handle *io,
uint64 count,
uint64 addr);
typedef void (*io_cleanup_fn)(io_handle *io, uint64 count);
typedef void (*io_cleanup_all_fn)(io_handle *io);
typedef void (*io_wait_all_fn)(io_handle *io);
typedef void (*io_register_thread_fn)(io_handle *io);
typedef void (*io_deregister_thread_fn)(io_handle *io);
typedef bool32 (*io_max_latency_elapsed_fn)(io_handle *io, timestamp ts);
Expand All @@ -76,7 +76,7 @@ typedef struct io_ops {
io_read_async_fn read_async;
io_write_async_fn write_async;
io_cleanup_fn cleanup;
io_cleanup_all_fn cleanup_all;
io_wait_all_fn wait_all;
io_register_thread_fn register_thread;
io_deregister_thread_fn deregister_thread;
io_max_latency_elapsed_fn max_latency_elapsed;
Expand Down Expand Up @@ -154,9 +154,9 @@ io_cleanup(io_handle *io, uint64 count)

// Guarantees all in-flight IOs are complete before return
static inline void
io_cleanup_all(io_handle *io)
io_wait_all(io_handle *io)
{
return io->ops->cleanup_all(io);
return io->ops->wait_all(io);
}

static inline void
Expand Down Expand Up @@ -184,14 +184,6 @@ io_max_latency_elapsed(io_handle *io, timestamp ts)
return TRUE;
}

// Return the opaque handle to the IO-context, established by
// a call to io_setup() off of this IO-handle 'io'.
static inline void *
io_get_context(io_handle *io)
{
return io->ops->get_context(io);
}

/*
*-----------------------------------------------------------------------------
* io_config_init --
Expand Down
Loading
Loading