diff options
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/Makefile.am | 3 | ||||
-rw-r--r-- | mysys/mf_keycache.c | 42 | ||||
-rw-r--r-- | mysys/mf_tempfile.c | 4 | ||||
-rw-r--r-- | mysys/my_crc32.c | 13 | ||||
-rw-r--r-- | mysys/my_lib.c | 11 |
5 files changed, 25 insertions, 48 deletions
diff --git a/mysys/Makefile.am b/mysys/Makefile.am index d4290bbc49b..3ffeeab0411 100644 --- a/mysys/Makefile.am +++ b/mysys/Makefile.am @@ -17,7 +17,8 @@ MYSQLDATAdir = $(localstatedir) MYSQLSHAREdir = $(pkgdatadir) MYSQLBASEdir= $(prefix) -INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) +INCLUDES = @MT_INCLUDES@ \ + @ZLIB_INCLUDES@ -I$(top_srcdir)/include -I$(srcdir) pkglib_LIBRARIES = libmysys.a LDADD = libmysys.a ../dbug/libdbug.a \ ../strings/libmystrings.a diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 75e3767c699..11aadbed6c1 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -29,10 +29,10 @@ to disk, if neccessary. This is handled in find_key_block(). With the new free list, the blocks can have three temperatures: hot, warm and cold (which is free). This is remembered in the block header - by the enum BLOCK_TEMPERATURE temperature variable. Remembering the - temperature is neccessary to correctly count the number of warm blocks, - which is required to decide when blocks are allowed to become hot. Whenever - a block is inserted to another (sub-)chain, we take the old and new + by the enum BLOCK_TEMPERATURE temperature variable. Remembering the + temperature is neccessary to correctly count the number of warm blocks, + which is required to decide when blocks are allowed to become hot. Whenever + a block is inserted to another (sub-)chain, we take the old and new temperature into account to decide if we got one more or less warm block. blocks_unused is the sum of never used blocks in the pool and of currently free blocks. blocks_used is the number of blocks fetched from the pool and @@ -475,13 +475,13 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, if (!keycache->key_cache_inited) DBUG_RETURN(keycache->disk_blocks); - + if(key_cache_block_size == keycache->key_cache_block_size && use_mem == keycache->key_cache_mem_size) { change_key_cache_param(keycache, division_limit, age_threshold); DBUG_RETURN(keycache->disk_blocks); - } + } keycache_pthread_mutex_lock(&keycache->cache_lock); @@ -504,7 +504,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size, goto finish; } keycache->resize_in_flush= 0; - keycache->can_be_used= 0; + keycache->can_be_used= 0; while (keycache->cnt_for_resize_op) { keycache_pthread_cond_wait(&thread->suspend, &keycache->cache_lock); @@ -540,9 +540,9 @@ static inline void inc_counter_for_resize_op(KEY_CACHE *keycache) */ static inline void dec_counter_for_resize_op(KEY_CACHE *keycache) { - struct st_my_thread_var *last_thread; + struct st_my_thread_var *last_thread; if (!--keycache->cnt_for_resize_op && - (last_thread= keycache->resize_queue.last_thread)) + (last_thread= keycache->resize_queue.last_thread)) keycache_pthread_cond_signal(&last_thread->next->suspend); } @@ -551,7 +551,7 @@ static inline void dec_counter_for_resize_op(KEY_CACHE *keycache) SYNOPSIS change_key_cache_param() - keycache pointer to a key cache data structure + keycache pointer to a key cache data structure division_limit new division limit (if not zero) age_threshold new age threshold (if not zero) @@ -625,7 +625,7 @@ writes: %ld r_requests: %ld reads: %ld", if (cleanup) { pthread_mutex_destroy(&keycache->cache_lock); - keycache->key_cache_inited= 0; + keycache->key_cache_inited= keycache->can_be_used= 0; KEYCACHE_DEBUG_CLOSE; } DBUG_VOID_RETURN; @@ -1316,7 +1316,7 @@ restart: return 0; } if (!(block->status & BLOCK_IN_FLUSH)) - { + { hash_link->requests--; /* Remove block to invalidate the page in the block buffer @@ -1327,9 +1327,9 @@ restart: buffer. Still we are guaranteed not to have any readers of the key part we are writing into until the block is removed from the cache as we set the BLOCL_REASSIGNED - flag (see the code below that handles reading requests). + flag (see the code below that handles reading requests). */ - free_block(keycache, block); + free_block(keycache, block); return 0; } /* Wait intil the page is flushed on disk */ @@ -1349,7 +1349,7 @@ restart: free_block(keycache, block); return 0; } - + if (page_status == PAGE_READ && (block->status & (BLOCK_IN_SWITCH | BLOCK_REASSIGNED))) { @@ -1694,7 +1694,7 @@ byte *key_cache_read(KEY_CACHE *keycache, do { keycache_pthread_mutex_lock(&keycache->cache_lock); - if (!keycache->can_be_used) + if (!keycache->can_be_used) { keycache_pthread_mutex_unlock(&keycache->cache_lock); goto no_key_cache; @@ -1830,7 +1830,7 @@ int key_cache_insert(KEY_CACHE *keycache, { uint offset; keycache_pthread_mutex_lock(&keycache->cache_lock); - if (!keycache->can_be_used) + if (!keycache->can_be_used) { keycache_pthread_mutex_unlock(&keycache->cache_lock); DBUG_RETURN(0); @@ -1874,7 +1874,7 @@ int key_cache_insert(KEY_CACHE *keycache, error= (block->status & BLOCK_ERROR); - dec_counter_for_resize_op(keycache); + dec_counter_for_resize_op(keycache); keycache_pthread_mutex_unlock(&keycache->cache_lock); @@ -1954,7 +1954,7 @@ int key_cache_write(KEY_CACHE *keycache, { uint offset; keycache_pthread_mutex_lock(&keycache->cache_lock); - if (!keycache->can_be_used) + if (!keycache->can_be_used) { keycache_pthread_mutex_unlock(&keycache->cache_lock); goto no_key_cache; @@ -2029,7 +2029,7 @@ int key_cache_write(KEY_CACHE *keycache, dec_counter_for_resize_op(keycache); keycache_pthread_mutex_unlock(&keycache->cache_lock); - + next_block: buff+= read_length; filepos+= read_length; @@ -2150,7 +2150,7 @@ static int flush_cached_blocks(KEY_CACHE *keycache, if (!last_errno) last_errno= errno ? errno : -1; } - /* + /* Let to proceed for possible waiting requests to write to the block page. It might happen only during an operation to resize the key cache. */ diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c index 0b337a74c19..af9ff0d6711 100644 --- a/mysys/mf_tempfile.c +++ b/mysys/mf_tempfile.c @@ -98,7 +98,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, if (strlen(dir)+ pfx_len > FN_REFLEN-2) { errno=my_errno= ENAMETOOLONG; - return 1; + DBUG_RETURN(file); } strmov(convert_dirname(to,dir,NullS),prefix_buff); org_file=mkstemp(to); @@ -124,7 +124,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, #ifdef OS2 /* changing environ variable doesn't work with VACPP */ char buffer[256], *end; - buffer[sizeof[buffer)-1]= 0; + buffer[sizeof(buffer)-1]= 0; end= strxnmov(buffer, sizeof(buffer)-1, (char*) "TMP=", dir, NullS); /* remove ending backslash */ if (end[-1] == '\\') diff --git a/mysys/my_crc32.c b/mysys/my_crc32.c index 5514b01ede2..db1beb58263 100644 --- a/mysys/my_crc32.c +++ b/mysys/my_crc32.c @@ -17,20 +17,7 @@ #include "mysys_priv.h" #ifndef HAVE_COMPRESS - -/* minimal set of defines for using crc32() from zlib codebase */ -#define _ZLIB_H -#define ZEXPORT -#define Z_NULL 0 -#define OF(args) args #undef DYNAMIC_CRC_TABLE -typedef uchar Byte; -typedef uchar Bytef; -typedef uint uInt; -typedef ulong uLong; -typedef ulong uLongf; - #include "../zlib/crc32.c" - #endif diff --git a/mysys/my_lib.c b/mysys/my_lib.c index b949fe17949..c3b0b57e549 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -461,17 +461,6 @@ MY_DIR *my_dir(const char *path, myf MyFlags) else finfo.mystat= NULL; - /* - If the directory is the root directory of the drive, Windows sometimes - creates hidden or system files there (like RECYCLER); do not show - them. We would need to see how this can be achieved with a Borland - compiler. - */ -#ifndef __BORLANDC__ - if (attrib & (_A_HIDDEN | _A_SYSTEM)) - continue; -#endif - if (push_dynamic(dir_entries_storage, (gptr)&finfo)) goto error; |