InnoDB used to hide the definition of fil_space_t and use numeric tablespace ID everywhere. This causes a large number of tablespace lookups and thus contention on the fil_system->mutex.
We should store fil_space_t* where possible to reduce the number of tablespace lookups:
- fil_system->sys_space for the innodb_system tablespace
- fil_system->temp_space for the innodb_temporary tablespace
- dict_table_t::space for user tables
- optionally, rseg_t::space for rollback segment header pages and and undo logs
Also, we should use atomic memory access in fil_space_release() and avoid acquiring the mutex there. Furthermore, some accessor functions, such as fil_space_get_type() and fil_space_get_first_path() must be removed.