Moved the code for freeing the ring of I/O context structures to a separate function.