Commit f8d46a00 authored by osku's avatar osku

Add 'level' parameter to rw_lock_create(), remove rw_lock_set_level().

parent 3762ef7d
......@@ -136,13 +136,12 @@ btr_search_sys_create(
btr_search_latch_temp = mem_alloc(sizeof(rw_lock_t));
rw_lock_create(&btr_search_latch);
rw_lock_create(&btr_search_latch, SYNC_SEARCH_SYS);
btr_search_sys = mem_alloc(sizeof(btr_search_sys_t));
btr_search_sys->hash_index = ha_create(TRUE, hash_size, 0, 0);
rw_lock_set_level(&btr_search_latch, SYNC_SEARCH_SYS);
}
/*********************************************************************
......
......@@ -524,12 +524,11 @@ buf_block_init(
block->n_pointers = 0;
rw_lock_create(&(block->lock));
rw_lock_create(&block->lock, SYNC_LEVEL_VARYING);
ut_ad(rw_lock_validate(&(block->lock)));
#ifdef UNIV_SYNC_DEBUG
rw_lock_create(&(block->debug_latch));
rw_lock_set_level(&(block->debug_latch), SYNC_NO_ORDER_CHECK);
rw_lock_create(&block->debug_latch, SYNC_NO_ORDER_CHECK);
#endif /* UNIV_SYNC_DEBUG */
}
......
......@@ -731,11 +731,11 @@ dict_init(void)
UT_LIST_INIT(dict_sys->table_LRU);
rw_lock_create(&dict_operation_lock);
rw_lock_set_level(&dict_operation_lock, SYNC_DICT_OPERATION);
rw_lock_create(&dict_operation_lock, SYNC_DICT_OPERATION);
dict_foreign_err_file = os_file_create_tmpfile();
ut_a(dict_foreign_err_file);
mutex_create(&dict_foreign_err_mutex, SYNC_ANY_LATCH);
}
......@@ -3607,9 +3607,7 @@ dict_tree_create(
tree->magic_n = DICT_TREE_MAGIC_N;
rw_lock_create(&(tree->lock));
rw_lock_set_level(&(tree->lock), SYNC_INDEX_TREE);
rw_lock_create(&tree->lock, SYNC_INDEX_TREE);
return(tree);
}
......
......@@ -1050,8 +1050,7 @@ try_again:
space->ibuf_data = NULL;
rw_lock_create(&(space->latch));
rw_lock_set_level(&(space->latch), SYNC_FSP);
rw_lock_create(&space->latch, SYNC_FSP);
HASH_INSERT(fil_space_t, hash, system->spaces, id, space);
......
......@@ -61,7 +61,7 @@ Creates, or rather, initializes an rw-lock object in a specified memory
location (which must be appropriately aligned). The rw-lock is initialized
to the non-locked state. Explicit freeing of the rw-lock with rw_lock_free
is necessary only if the memory block containing it is freed. */
#define rw_lock_create(L) rw_lock_create_func((L), __FILE__, __LINE__, #L)
#define rw_lock_create(L, level) rw_lock_create_func((L), (level), __FILE__, __LINE__, #L)
/*=====================*/
/**********************************************************************
......@@ -74,9 +74,10 @@ void
rw_lock_create_func(
/*================*/
rw_lock_t* lock, /* in: pointer to memory */
ulint level, /* in: level */
const char* cfile_name, /* in: file name where created */
ulint cline, /* in: file line where created */
const char* cmutex_name); /* in: mutex name */
ulint cline, /* in: file line where created */
const char* cmutex_name); /* in: mutex name */
/**********************************************************************
Calling this function is obligatory only if the memory buffer containing
the rw-lock is freed. Removes an rw-lock object from the global list. The
......@@ -299,14 +300,6 @@ rw_lock_x_unlock_direct(
/*====================*/
rw_lock_t* lock); /* in: rw-lock */
/**********************************************************************
Sets the rw-lock latching level field. */
void
rw_lock_set_level(
/*==============*/
rw_lock_t* lock, /* in: rw-lock */
ulint level); /* in: level */
/**********************************************************************
Returns the value of writer_count for the lock. Does not reserve the lock
mutex, so the caller must be sure it is not changed during the call. */
UNIV_INLINE
......
......@@ -797,8 +797,7 @@ log_init(void)
log_sys->last_checkpoint_lsn = log_sys->lsn;
log_sys->n_pending_checkpoint_writes = 0;
rw_lock_create(&(log_sys->checkpoint_lock));
rw_lock_set_level(&(log_sys->checkpoint_lock), SYNC_NO_ORDER_CHECK);
rw_lock_create(&log_sys->checkpoint_lock, SYNC_NO_ORDER_CHECK);
log_sys->checkpoint_buf = ut_align(
mem_alloc(2 * OS_FILE_LOG_BLOCK_SIZE),
......@@ -814,8 +813,7 @@ log_init(void)
log_sys->n_pending_archive_ios = 0;
rw_lock_create(&(log_sys->archive_lock));
rw_lock_set_level(&(log_sys->archive_lock), SYNC_NO_ORDER_CHECK);
rw_lock_create(&log_sys->archive_lock, SYNC_NO_ORDER_CHECK);
log_sys->archive_buf = NULL;
......
......@@ -89,9 +89,10 @@ void
rw_lock_create_func(
/*================*/
rw_lock_t* lock, /* in: pointer to memory */
ulint level, /* in: level */
const char* cfile_name, /* in: file name where created */
ulint cline, /* in: file line where created */
const char* cmutex_name) /* in: mutex name */
const char* cmutex_name) /* in: mutex name */
{
/* If this is the very first time a synchronization object is
created, then the following call initializes the sync system. */
......@@ -115,10 +116,10 @@ rw_lock_create_func(
#ifdef UNIV_SYNC_DEBUG
UT_LIST_INIT(lock->debug_list);
lock->level = SYNC_LEVEL_VARYING;
#endif /* UNIV_SYNC_DEBUG */
lock->level = level;
lock->magic_n = RW_LOCK_MAGIC_N;
lock->cfile_name = cfile_name;
......@@ -669,18 +670,6 @@ rw_lock_remove_debug_info(
}
#endif /* UNIV_SYNC_DEBUG */
/**********************************************************************
Sets the rw-lock latching level field. */
void
rw_lock_set_level(
/*==============*/
rw_lock_t* lock, /* in: rw-lock */
ulint level) /* in: level */
{
lock->level = level;
}
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
Checks if the thread has locked the rw-lock in the specified mode, with
......
......@@ -211,8 +211,7 @@ trx_purge_sys_create(void)
purge_sys->purge_undo_no = ut_dulint_zero;
purge_sys->next_stored = FALSE;
rw_lock_create(&(purge_sys->latch));
rw_lock_set_level(&(purge_sys->latch), SYNC_PURGE_LATCH);
rw_lock_create(&purge_sys->latch, SYNC_PURGE_LATCH);
mutex_create(&purge_sys->mutex, SYNC_PURGE_SYS);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment