diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-01-25 15:59:37 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-01-25 16:00:34 +0200 |
commit | 0b1a40852cd9204b9ed7394bed67e95e02c96a9d (patch) | |
tree | a3641ee35ef3d7999f42d34867d0425a5b9f3078 | |
parent | 8afe4faab9e1ed8a2264cb309c02fca641be1990 (diff) | |
download | mariadb-git-0b1a40852cd9204b9ed7394bed67e95e02c96a9d.tar.gz |
Replace fil_node_t::is_open with fil_node_t::is_open().
This should be a non-functional change (apart from removing the
redundant data field).
-rw-r--r-- | storage/innobase/fil/fil0fil.cc | 48 | ||||
-rw-r--r-- | storage/innobase/include/fil0fil.h | 8 | ||||
-rw-r--r-- | storage/innobase/include/os0file.h | 2 |
3 files changed, 32 insertions, 26 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 5907fa11b4d..b09d8ff873a 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -504,6 +504,8 @@ fil_node_create_low( node = reinterpret_cast<fil_node_t*>(ut_zalloc_nokey(sizeof(*node))); + node->handle = OS_FILE_CLOSED; + node->name = mem_strdup(name); ut_a(!is_raw || srv_start_raw_disk_in_use); @@ -577,7 +579,7 @@ fil_node_open_file( ut_ad(mutex_own(&fil_system->mutex)); ut_a(node->n_pending == 0); - ut_a(!node->is_open); + ut_a(!node->is_open()); read_only_mode = !fsp_is_system_temporary(space->id) && srv_read_only_mode; @@ -747,8 +749,7 @@ retry: } ut_a(success); - - node->is_open = true; + ut_a(node->is_open()); fil_system->n_open++; fil_n_file_opened++; @@ -772,7 +773,7 @@ fil_node_close_file( bool ret; ut_ad(mutex_own(&(fil_system->mutex))); - ut_a(node->is_open); + ut_a(node->is_open()); ut_a(node->n_pending == 0); ut_a(node->n_pending_flushes == 0); ut_a(!node->being_extended); @@ -785,7 +786,8 @@ fil_node_close_file( /* printf("Closing file %s\n", node->name); */ - node->is_open = false; + node->handle = OS_FILE_CLOSED; + ut_ad(!node->is_open()); ut_a(fil_system->n_open > 0); fil_system->n_open--; fil_n_file_opened--; @@ -907,7 +909,7 @@ fil_flush_low(fil_space_t* space) continue; } - ut_a(node->is_open); + ut_a(node->is_open()); switch (space->purpose) { case FIL_TYPE_TEMPORARY: @@ -950,7 +952,7 @@ retry: goto retry; } - ut_a(node->is_open); + ut_a(node->is_open()); node->n_pending_flushes++; mutex_exit(&fil_system->mutex); @@ -1269,7 +1271,7 @@ fil_mutex_enter_and_prepare_for_io( the insert buffer. The insert buffer is in tablespace 0, and we cannot end up waiting in this function. */ - } else if (!node || node->is_open) { + } else if (!node || node->is_open()) { /* If the file is already open, no need to do anything; if the space does not exist, we handle the situation in the function which called this @@ -1374,7 +1376,7 @@ fil_node_close_to_free( ut_a(node->n_pending == 0); ut_a(!node->being_extended); - if (node->is_open) { + if (node->is_open()) { /* We fool the assertion in fil_node_close_file() to think there are no unflushed modifications in the file */ @@ -1887,7 +1889,7 @@ fil_space_open( node != NULL; node = UT_LIST_GET_NEXT(chain, node)) { - if (!node->is_open + if (!node->is_open() && !fil_node_open_file(node)) { mutex_exit(&fil_system->mutex); return(false); @@ -1921,7 +1923,7 @@ fil_space_close( node != NULL; node = UT_LIST_GET_NEXT(chain, node)) { - if (node->is_open) { + if (node->is_open()) { fil_node_close_file(node); } } @@ -2012,7 +2014,7 @@ fil_open_log_and_system_tablespace_files(void) node != NULL; node = UT_LIST_GET_NEXT(chain, node)) { - if (!node->is_open) { + if (!node->is_open()) { if (!fil_node_open_file(node)) { /* This func is called during server's startup. If some file of log or system @@ -2070,7 +2072,7 @@ fil_close_all_files(void) node != NULL; node = UT_LIST_GET_NEXT(chain, node)) { - if (node->is_open) { + if (node->is_open()) { fil_node_close_file(node); } } @@ -2116,7 +2118,7 @@ fil_close_log_files( node != NULL; node = UT_LIST_GET_NEXT(chain, node)) { - if (node->is_open) { + if (node->is_open()) { fil_node_close_file(node); } } @@ -3130,7 +3132,7 @@ fil_truncate_tablespace( fil_node_t* node = UT_LIST_GET_FIRST(space->chain); - ut_ad(node->is_open); + ut_ad(node->is_open()); space->size = node->size = size_in_pages; @@ -3544,7 +3546,7 @@ func_exit: } else if (node->modification_counter > node->flush_counter) { /* Flush the space */ sleep = flush = true; - } else if (node->is_open) { + } else if (node->is_open()) { /* Close the file */ fil_node_close_file(node); @@ -4936,7 +4938,7 @@ fil_node_prepare_for_io( << " exceeds the limit " << system->max_n_open; } - if (!node->is_open) { + if (!node->is_open()) { /* File is closed: open it */ ut_a(node->n_pending == 0); @@ -5485,8 +5487,8 @@ struct Check { @param[in] elem file node to visit */ void operator()(const fil_node_t* elem) { - ut_a(elem->is_open || !elem->n_pending); - n_open += elem->is_open; + ut_a(elem->is_open() || !elem->n_pending); + n_open += elem->is_open(); size += elem->size; } @@ -5540,7 +5542,7 @@ fil_validate(void) ut_a(fil_node->n_pending == 0); ut_a(!fil_node->being_extended); - ut_a(fil_node->is_open); + ut_a(fil_node->is_open()); ut_a(fil_space_belongs_in_lru(fil_node->space)); } @@ -6499,7 +6501,7 @@ truncate_t::truncate( space->size = node->size = FIL_IBD_FILE_INITIAL_SIZE; } - const bool already_open = node->is_open; + const bool already_open = node->is_open(); if (!already_open) { @@ -6520,7 +6522,7 @@ truncate_t::truncate( return(DB_ERROR); } - node->is_open = true; + ut_a(node->is_open()); } os_offset_t trunc_size = trunc_to_default @@ -6550,7 +6552,7 @@ truncate_t::truncate( err = DB_ERROR; } else { - node->is_open = false; + node->handle = OS_FILE_CLOSED; } } diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index bd6067fbbee..e3df97d028c 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -201,8 +201,6 @@ struct fil_node_t { fil_space_t* space; /** file name; protected by fil_system->mutex and log_sys->mutex. */ char* name; - /** whether this file is open */ - bool is_open; /** file handle (valid if is_open) */ os_file_t handle; /** event that groups and serializes calls to fsync */ @@ -241,6 +239,12 @@ struct fil_node_t { /** FIL_NODE_MAGIC_N */ ulint magic_n; + + /** @return whether this file is open */ + bool is_open() const + { + return(handle != OS_FILE_CLOSED); + } }; /** Value of fil_node_t::magic_n */ diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 68369a49c5f..4e980c42f85 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -80,7 +80,7 @@ the OS actually supports it: Win 95 does not, NT does. */ # define UNIV_NON_BUFFERED_IO /** File handle */ -# define os_file_t HANDLE +typedef HANDLE os_file_t; /** Convert a C file descriptor to a native file handle @param fd file descriptor |