From 4338bb8a752a05a456cfc10dbecb2a533141025c Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Fri, 3 Apr 2020 20:53:53 +0400 Subject: [PATCH] Coding style fixes --- include/my_bit.h | 5 +++-- include/my_sys.h | 6 +++--- mysys/mf_keycache.c | 3 ++- mysys/my_largepage.c | 28 +++++++++++++++------------- sql/mysqld.cc | 6 ++++-- storage/innobase/os/os0proc.cc | 2 +- 6 files changed, 28 insertions(+), 22 deletions(-) diff --git a/include/my_bit.h b/include/my_bit.h index c2e5e41c4a1..8ee8b41c8d4 100644 --- a/include/my_bit.h +++ b/include/my_bit.h @@ -74,8 +74,9 @@ static inline CONSTEXPR uint my_bit_log2_size_t(size_t value) { #ifdef __cplusplus static_assert(sizeof(size_t) <= sizeof(ulonglong), - "size_t <= ulonglong is an assumption that needs to be fixed for this architecture. " - "Please create an issue on https://jira.mariadb.org"); + "size_t <= ulonglong is an assumption that needs to be fixed " + "for this architecture. Please create an issue on " + "https://jira.mariadb.org"); #endif return my_bit_log2_uint64((ulonglong) value); } diff --git a/include/my_sys.h b/include/my_sys.h index 3c6480fc832..3a5184fb27e 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -185,11 +185,11 @@ extern void my_get_large_page_size(void); #ifdef HAVE_LARGE_PAGE_OPTION int my_init_large_pages(my_bool super_large_pages); -uchar * my_large_malloc(size_t *size, myf my_flags); +uchar *my_large_malloc(size_t *size, myf my_flags); void my_large_free(void *ptr, size_t size); #else -#define my_large_malloc(A,B) my_malloc_lock(*(A),(B)) -#define my_large_free(A,B) my_free_lock((A)) +#define my_large_malloc(A, B) my_malloc_lock(*(A), (B)) +#define my_large_free(A, B) my_free_lock((A)) #endif /* HAVE_LARGE_PAGE_OPTION */ #ifdef _WIN32 diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index ab085c8e3b7..ec5e39938b6 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -547,7 +547,8 @@ int init_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache, ((size_t) blocks * keycache->key_cache_block_size) > use_mem && blocks > 8) blocks--; keycache->allocated_mem_size= blocks * keycache->key_cache_block_size; - if ((keycache->block_mem=my_large_malloc(&keycache->allocated_mem_size, MYF(0)))) + if ((keycache->block_mem= my_large_malloc(&keycache->allocated_mem_size, + MYF(0)))) { /* Allocate memory for blocks, hash_links and hash entries; diff --git a/mysys/my_largepage.c b/mysys/my_largepage.c index 9d84cbca6ec..ef9c21fc0a8 100644 --- a/mysys/my_largepage.c +++ b/mysys/my_largepage.c @@ -125,8 +125,9 @@ int my_init_large_pages(my_bool super_large_pages) my_get_large_page_sizes(my_large_page_sizes); if (!my_obtain_privilege(SE_LOCK_MEMORY_NAME)) { - fprintf(stderr, "mysqld: Lock Pages in memory access rights required for use with large-pages, " - "see https://mariadb.com/kb/en/library/mariadb-memory-allocation/#huge-pages"); + fprintf(stderr, "mysqld: Lock Pages in memory access rights required for " + "use with large-pages, see https://mariadb.com/kb/en/library/" + "mariadb-memory-allocation/#huge-pages"); return 1; } #ifdef HAVE_SOLARIS_LARGE_PAGES @@ -158,12 +159,12 @@ int my_init_large_pages(my_bool super_large_pages) mpss.mha_cmd= MHA_MAPSIZE_BSSBRK; mpss.mha_pagesize= max_page_size; mpss.mha_flags= 0; - if (memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mpss, 0, 0)) + if (memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t) &mpss, 0, 0)) { perror("memcntl MC_HAT_ADVISE cmd MHA_MAPSIZE_BSSBRK error (continuing)"); } mpss.mha_cmd= MHA_MAPSIZE_STACK; - if (memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t)&mpss, 0, 0)) + if (memcntl(NULL, 0, MC_HAT_ADVISE, (caddr_t) &mpss, 0, 0)) { perror("memcntl MC_HAT_ADVISE cmd MHA_MAPSIZE_STACK error (continuing)"); } @@ -245,15 +246,15 @@ static void my_get_large_page_sizes(size_t sizes[my_large_page_sizes_length]) } else { - while (i < my_large_page_sizes_length && - (r= readdir(dirp))) + while (i < my_large_page_sizes_length && (r= readdir(dirp))) { if (strncmp("hugepages-", r->d_name, 10) == 0) { sizes[i]= strtoull(r->d_name + 10, NULL, 10) * 1024ULL; if (!my_is_2pow(sizes[i])) { - fprintf(stderr, "Warning: non-power of 2 large page size (%zu) found, skipping\n", sizes[i]); + fprintf(stderr, "Warning: non-power of 2 large page size (%zu) found," + " skipping\n", sizes[i]); sizes[i]= 0; continue; } @@ -312,7 +313,8 @@ uchar* my_large_malloc_int(size_t *size, myf my_flags) { fprintf(stderr, "Warning: Failed to allocate %zu bytes from HugeTLB memory" - "(page size %zu). errno %d\n", aligned_size, large_page_size, errno); + "(page size %zu). errno %d\n", aligned_size, large_page_size, + errno); } else { @@ -332,11 +334,11 @@ uchar* my_large_malloc_int(size_t *size, myf my_flags) { if (large_page_size) { - /* - we do need to record the adjustment so that munmap gets called with - the right size. This is only the case for HUGETLB pages. - */ - *size= aligned_size; + /* + we do need to record the adjustment so that munmap gets called with + the right size. This is only the case for HUGETLB pages. + */ + *size= aligned_size; } DBUG_RETURN(ptr); } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b7c93280004..54228cfab05 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5042,8 +5042,10 @@ static int init_server_components() {"timed-mutexes", OPT_DEPRECATED_OPTION, "", 0, 0, 0, GET_NO_ARG, OPT_ARG, 0, 0, 0, 0, 0, 0}, #if defined(__linux__) - /* Linux was the only large page OS that we've now removed the (always) - unused super-large-pages (because its Solaris only). */ + /* + Linux was the only large page OS that we've now removed the (always) + unused super-large-pages (because its Solaris only). + */ {"super-large-pages", OPT_DEPRECATED_OPTION, "", 0, 0, 0, GET_NO_ARG, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif diff --git a/storage/innobase/os/os0proc.cc b/storage/innobase/os/os0proc.cc index 8cea535ff2a..32747aae3ab 100644 --- a/storage/innobase/os/os0proc.cc +++ b/storage/innobase/os/os0proc.cc @@ -28,7 +28,7 @@ Created 9/30/1995 Heikki Tuuri #include "univ.i" /** The total amount of memory currently allocated from the operating -system with os_mem_alloc_large(). */ +system with allocacte_large(). */ Atomic_counter os_total_large_mem_allocated; /** Converts the current process id to a number.