Rename utils_allocator to utils_realloc
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
cda536a14a
commit
ab2fc6d3c3
@ -10,7 +10,7 @@
|
|||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
#include "../utils/utils_cleaner.h"
|
#include "../utils/utils_cleaner.h"
|
||||||
#include "../utils/utils_part.h"
|
#include "../utils/utils_part.h"
|
||||||
#include "../utils/utils_allocator.h"
|
#include "../utils/utils_realloc.h"
|
||||||
#include "../concurrency/ocf_cache_concurrency.h"
|
#include "../concurrency/ocf_cache_concurrency.h"
|
||||||
#include "../ocf_def_priv.h"
|
#include "../ocf_def_priv.h"
|
||||||
#include "cleaning_priv.h"
|
#include "cleaning_priv.h"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "../ocf_priv.h"
|
#include "../ocf_priv.h"
|
||||||
#include "../ocf_request.h"
|
#include "../ocf_request.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_allocator.h"
|
#include "../utils/utils_realloc.h"
|
||||||
|
|
||||||
#define OCF_CACHE_CONCURRENCY_DEBUG 0
|
#define OCF_CACHE_CONCURRENCY_DEBUG 0
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "../engine/engine_common.h"
|
#include "../engine/engine_common.h"
|
||||||
#include "../engine/engine_bf.h"
|
#include "../engine/engine_bf.h"
|
||||||
#include "../utils/utils_cache_line.h"
|
#include "../utils/utils_cache_line.h"
|
||||||
#include "../utils/utils_allocator.h"
|
#include "../utils/utils_realloc.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../ocf_def_priv.h"
|
#include "../ocf_def_priv.h"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "../ocf_cache_priv.h"
|
#include "../ocf_cache_priv.h"
|
||||||
#include "../ocf_ctx_priv.h"
|
#include "../ocf_ctx_priv.h"
|
||||||
#include "../utils/utils_io.h"
|
#include "../utils/utils_io.h"
|
||||||
#include "../utils/utils_allocator.h"
|
#include "../utils/utils_realloc.h"
|
||||||
|
|
||||||
int ocf_metadata_updater_init(ocf_cache_t cache)
|
int ocf_metadata_updater_init(ocf_cache_t cache)
|
||||||
{
|
{
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||||
*/
|
*/
|
||||||
#include "ocf/ocf.h"
|
#include "ocf/ocf.h"
|
||||||
#include "utils_allocator.h"
|
#include "utils_realloc.h"
|
||||||
#include "ocf_env.h"
|
#include "ocf_env.h"
|
||||||
|
|
||||||
#define OCF_ALLOCATOR_K_MAX (128 * KiB)
|
#define OCF_REALLOC_K_MAX (128 * KiB)
|
||||||
|
|
||||||
static int _ocf_realloc_with_cp(void **mem, size_t size, size_t count,
|
static int _ocf_realloc_with_cp(void **mem, size_t size, size_t count,
|
||||||
size_t *limit, bool cp)
|
size_t *limit, bool cp)
|
||||||
@ -24,7 +24,7 @@ static int _ocf_realloc_with_cp(void **mem, size_t size, size_t count,
|
|||||||
|
|
||||||
void *new_mem;
|
void *new_mem;
|
||||||
|
|
||||||
if (alloc_size > OCF_ALLOCATOR_K_MAX)
|
if (alloc_size > OCF_REALLOC_K_MAX)
|
||||||
new_mem = env_vzalloc(alloc_size);
|
new_mem = env_vzalloc(alloc_size);
|
||||||
else
|
else
|
||||||
new_mem = env_zalloc(alloc_size, ENV_MEM_NOIO);
|
new_mem = env_zalloc(alloc_size, ENV_MEM_NOIO);
|
||||||
@ -44,7 +44,7 @@ static int _ocf_realloc_with_cp(void **mem, size_t size, size_t count,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*limit > OCF_ALLOCATOR_K_MAX)
|
if (*limit > OCF_REALLOC_K_MAX)
|
||||||
env_vfree(*mem);
|
env_vfree(*mem);
|
||||||
else
|
else
|
||||||
env_free(*mem);
|
env_free(*mem);
|
||||||
@ -74,7 +74,7 @@ static int _ocf_realloc_with_cp(void **mem, size_t size, size_t count,
|
|||||||
|
|
||||||
if ((*mem) && (*limit)) {
|
if ((*mem) && (*limit)) {
|
||||||
/* Need to free memory */
|
/* Need to free memory */
|
||||||
if (*limit > OCF_ALLOCATOR_K_MAX)
|
if (*limit > OCF_REALLOC_K_MAX)
|
||||||
env_vfree(*mem);
|
env_vfree(*mem);
|
||||||
else
|
else
|
||||||
env_free(*mem);
|
env_free(*mem);
|
@ -3,12 +3,12 @@
|
|||||||
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef UTILS_ALLOCATOR_H_
|
#ifndef UTILS_REALLOC_H_
|
||||||
#define UTILS_ALLOCATOR_H_
|
#define UTILS_REALLOC_H_
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file utils_allocator.h
|
* @file utils_realloc.h
|
||||||
* @brief OCF memory reallocator
|
* @brief OCF realloc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void ocf_realloc_init(void **mem, size_t *limit);
|
void ocf_realloc_init(void **mem, size_t *limit);
|
||||||
@ -66,4 +66,4 @@ int ocf_realloc_cp(void **mem, size_t size, size_t count, size_t *limit);
|
|||||||
#define OCF_REALLOC_CP(mem, size, count, limit) \
|
#define OCF_REALLOC_CP(mem, size, count, limit) \
|
||||||
ocf_realloc_cp((void **)mem, size, count, limit)
|
ocf_realloc_cp((void **)mem, size, count, limit)
|
||||||
|
|
||||||
#endif /* UTILS_ALLOCATOR_H_ */
|
#endif /* UTILS_REALLOC_H_ */
|
@ -31,7 +31,7 @@
|
|||||||
#include "../metadata/metadata.h"
|
#include "../metadata/metadata.h"
|
||||||
#include "../utils/utils_cleaner.h"
|
#include "../utils/utils_cleaner.h"
|
||||||
#include "../utils/utils_part.h"
|
#include "../utils/utils_part.h"
|
||||||
#include "../utils/utils_allocator.h"
|
#include "../utils/utils_realloc.h"
|
||||||
#include "../concurrency/ocf_cache_concurrency.h"
|
#include "../concurrency/ocf_cache_concurrency.h"
|
||||||
#include "../ocf_def_priv.h"
|
#include "../ocf_def_priv.h"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user