summaryrefslogtreecommitdiffstats
path: root/src/H5PB.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5PB.c')
-rw-r--r--src/H5PB.c152
1 files changed, 76 insertions, 76 deletions
diff --git a/src/H5PB.c b/src/H5PB.c
index 069ee19..54a6a3a 100644
--- a/src/H5PB.c
+++ b/src/H5PB.c
@@ -78,8 +78,8 @@
#define H5PB__INSERT_LRU(page_buf, page_ptr) \
{ \
- HDassert(page_buf); \
- HDassert(page_ptr); \
+ assert(page_buf); \
+ assert(page_ptr); \
/* insert the entry at the head of the list. */ \
H5PB__PREPEND((page_ptr), (page_buf)->LRU_head_ptr, (page_buf)->LRU_tail_ptr, \
(page_buf)->LRU_list_len) \
@@ -87,8 +87,8 @@
#define H5PB__REMOVE_LRU(page_buf, page_ptr) \
{ \
- HDassert(page_buf); \
- HDassert(page_ptr); \
+ assert(page_buf); \
+ assert(page_ptr); \
/* remove the entry from the list. */ \
H5PB__REMOVE((page_ptr), (page_buf)->LRU_head_ptr, (page_buf)->LRU_tail_ptr, \
(page_buf)->LRU_list_len) \
@@ -96,8 +96,8 @@
#define H5PB__MOVE_TO_TOP_LRU(page_buf, page_ptr) \
{ \
- HDassert(page_buf); \
- HDassert(page_ptr); \
+ assert(page_buf); \
+ assert(page_ptr); \
/* Remove entry and insert at the head of the list. */ \
H5PB__REMOVE((page_ptr), (page_buf)->LRU_head_ptr, (page_buf)->LRU_tail_ptr, \
(page_buf)->LRU_list_len) \
@@ -163,7 +163,7 @@ H5PB_reset_stats(H5PB_t *page_buf)
FUNC_ENTER_NOAPI_NOERR
/* Sanity checks */
- HDassert(page_buf);
+ assert(page_buf);
page_buf->accesses[0] = 0;
page_buf->accesses[1] = 0;
@@ -205,7 +205,7 @@ H5PB_get_stats(const H5PB_t *page_buf, unsigned accesses[2], unsigned hits[2], u
FUNC_ENTER_NOAPI_NOERR
/* Sanity checks */
- HDassert(page_buf);
+ assert(page_buf);
accesses[0] = page_buf->accesses[0];
accesses[1] = page_buf->accesses[1];
@@ -240,29 +240,29 @@ H5PB_print_stats(const H5PB_t *page_buf)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
- HDassert(page_buf);
-
- HDprintf("PAGE BUFFER STATISTICS:\n");
-
- HDprintf("******* METADATA\n");
- HDprintf("\t Total Accesses: %u\n", page_buf->accesses[0]);
- HDprintf("\t Hits: %u\n", page_buf->hits[0]);
- HDprintf("\t Misses: %u\n", page_buf->misses[0]);
- HDprintf("\t Evictions: %u\n", page_buf->evictions[0]);
- HDprintf("\t Bypasses: %u\n", page_buf->bypasses[0]);
- HDprintf("\t Hit Rate = %f%%\n",
- ((double)page_buf->hits[0] / (page_buf->accesses[0] - page_buf->bypasses[0])) * 100);
- HDprintf("*****************\n\n");
-
- HDprintf("******* RAWDATA\n");
- HDprintf("\t Total Accesses: %u\n", page_buf->accesses[1]);
- HDprintf("\t Hits: %u\n", page_buf->hits[1]);
- HDprintf("\t Misses: %u\n", page_buf->misses[1]);
- HDprintf("\t Evictions: %u\n", page_buf->evictions[1]);
- HDprintf("\t Bypasses: %u\n", page_buf->bypasses[1]);
- HDprintf("\t Hit Rate = %f%%\n",
- ((double)page_buf->hits[1] / (page_buf->accesses[1] - page_buf->bypasses[0])) * 100);
- HDprintf("*****************\n\n");
+ assert(page_buf);
+
+ printf("PAGE BUFFER STATISTICS:\n");
+
+ printf("******* METADATA\n");
+ printf("\t Total Accesses: %u\n", page_buf->accesses[0]);
+ printf("\t Hits: %u\n", page_buf->hits[0]);
+ printf("\t Misses: %u\n", page_buf->misses[0]);
+ printf("\t Evictions: %u\n", page_buf->evictions[0]);
+ printf("\t Bypasses: %u\n", page_buf->bypasses[0]);
+ printf("\t Hit Rate = %f%%\n",
+ ((double)page_buf->hits[0] / (page_buf->accesses[0] - page_buf->bypasses[0])) * 100);
+ printf("*****************\n\n");
+
+ printf("******* RAWDATA\n");
+ printf("\t Total Accesses: %u\n", page_buf->accesses[1]);
+ printf("\t Hits: %u\n", page_buf->hits[1]);
+ printf("\t Misses: %u\n", page_buf->misses[1]);
+ printf("\t Evictions: %u\n", page_buf->evictions[1]);
+ printf("\t Bypasses: %u\n", page_buf->bypasses[1]);
+ printf("\t Hit Rate = %f%%\n",
+ ((double)page_buf->hits[1] / (page_buf->accesses[1] - page_buf->bypasses[0])) * 100);
+ printf("*****************\n\n");
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5PB_print_stats */
@@ -287,7 +287,7 @@ H5PB_create(H5F_shared_t *f_sh, size_t size, unsigned page_buf_min_meta_perc, un
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f_sh);
+ assert(f_sh);
/* Check args */
if (f_sh->fs_strategy != H5F_FSPACE_STRATEGY_PAGE)
@@ -364,8 +364,8 @@ H5PB__flush_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data)
FUNC_ENTER_PACKAGE
/* Sanity checks */
- HDassert(page_entry);
- HDassert(f_sh);
+ assert(page_entry);
+ assert(f_sh);
/* Flush the page if it's dirty */
if (page_entry->is_dirty)
@@ -395,7 +395,7 @@ H5PB_flush(H5F_shared_t *f_sh)
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
- HDassert(f_sh);
+ assert(f_sh);
/* Flush all the entries in the PB skiplist, if we have write access on the file */
if (f_sh->page_buf && (H5F_ACC_RDWR & H5F_SHARED_INTENT(f_sh))) {
@@ -430,9 +430,9 @@ H5PB__dest_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data)
FUNC_ENTER_PACKAGE_NOERR
/* Sanity checking */
- HDassert(page_entry);
- HDassert(op_data);
- HDassert(op_data->page_buf);
+ assert(page_entry);
+ assert(op_data);
+ assert(op_data->page_buf);
/* Remove entry from LRU list */
if (op_data->actual_slist) {
@@ -465,7 +465,7 @@ H5PB_dest(H5F_shared_t *f_sh)
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f_sh);
+ assert(f_sh);
/* flush and destroy the page buffer, if it exists */
if (f_sh->page_buf) {
@@ -523,9 +523,9 @@ H5PB_add_new_page(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t page_addr)
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f_sh);
+ assert(f_sh);
page_buf = f_sh->page_buf;
- HDassert(page_buf);
+ assert(page_buf);
/* If there is an existing page, this means that at some point the
* file free space manager freed and re-allocated a page at the same
@@ -581,9 +581,9 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf)
FUNC_ENTER_NOAPI_NOERR
/* Sanity checks */
- HDassert(page_buf);
- HDassert(size <= page_buf->page_size);
- HDassert(buf);
+ assert(page_buf);
+ assert(size <= page_buf->page_size);
+ assert(buf);
/* calculate the aligned address of the first page */
page_addr = (addr / page_buf->page_size) * page_buf->page_size;
@@ -593,7 +593,7 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf)
if (page_entry) {
haddr_t offset;
- HDassert(addr + size <= page_addr + page_buf->page_size);
+ assert(addr + size <= page_addr + page_buf->page_size);
offset = addr - page_addr;
H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, size);
@@ -629,22 +629,22 @@ H5PB_remove_entry(const H5F_shared_t *f_sh, haddr_t addr)
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f_sh);
+ assert(f_sh);
page_buf = f_sh->page_buf;
- HDassert(page_buf);
+ assert(page_buf);
/* Search for address in the skip list */
page_entry = (H5PB_entry_t *)H5SL_search(page_buf->slist_ptr, (void *)(&addr));
/* If found, remove the entry from the PB cache */
if (page_entry) {
- HDassert(page_entry->type != H5F_MEM_PAGE_DRAW);
+ assert(page_entry->type != H5F_MEM_PAGE_DRAW);
if (NULL == H5SL_remove(page_buf->slist_ptr, &(page_entry->addr)))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Page Entry is not in skip list")
/* Remove from LRU list */
H5PB__REMOVE_LRU(page_buf, page_entry)
- HDassert(H5SL_count(page_buf->slist_ptr) == page_buf->LRU_list_len);
+ assert(H5SL_count(page_buf->slist_ptr) == page_buf->LRU_list_len);
page_buf->meta_count--;
@@ -686,8 +686,8 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f_sh);
- HDassert(type != H5FD_MEM_GHEAP);
+ assert(f_sh);
+ assert(type != H5FD_MEM_GHEAP);
/* Get pointer to page buffer info for this file */
page_buf = f_sh->page_buf;
@@ -753,7 +753,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *
num_touched_pages =
(last_page_addr / page_buf->page_size + 1) - (first_page_addr / page_buf->page_size);
if (first_page_addr == last_page_addr) {
- HDassert(1 == num_touched_pages);
+ assert(1 == num_touched_pages);
last_page_addr = HADDR_UNDEF;
} /* end if */
} /* end if */
@@ -788,20 +788,20 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *
if (node) {
page_entry = (H5PB_entry_t *)H5SL_item(node);
- HDassert(page_entry);
+ assert(page_entry);
/* If the current page address falls out of the access
block, then there are no more pages to go over */
if (page_entry->addr >= addr + size)
break;
- HDassert(page_entry->addr == search_addr);
+ assert(page_entry->addr == search_addr);
if (page_entry->is_dirty) {
/* special handling for the first page if it is not a full page access */
if (i == 0 && first_page_addr != addr) {
offset = addr - first_page_addr;
- HDassert(page_buf->page_size > offset);
+ assert(page_buf->page_size > offset);
H5MM_memcpy(buf, (uint8_t *)page_entry->page_buf_ptr + offset,
page_buf->page_size - (size_t)offset);
@@ -836,7 +836,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *
else {
/* A raw data access could span 1 or 2 PB entries at this point so
we need to handle that */
- HDassert(1 == num_touched_pages || 2 == num_touched_pages);
+ assert(1 == num_touched_pages || 2 == num_touched_pages);
for (i = 0; i < num_touched_pages; i++) {
haddr_t buf_offset;
@@ -890,7 +890,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void *
if (0 == can_make_space) {
/* make space can't return FALSE on second touched page since the first is of the same
* type */
- HDassert(0 == i);
+ assert(0 == i);
/* read entire block from VFD and return */
if (H5FD_read(file, type, addr, size, buf) < 0)
@@ -987,7 +987,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- HDassert(f_sh);
+ assert(f_sh);
/* Get pointer to page buffer info for this file */
page_buf = f_sh->page_buf;
@@ -1061,7 +1061,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const
num_touched_pages =
(last_page_addr / page_buf->page_size + 1) - (first_page_addr / page_buf->page_size);
if (first_page_addr == last_page_addr) {
- HDassert(1 == num_touched_pages);
+ assert(1 == num_touched_pages);
last_page_addr = HADDR_UNDEF;
} /* end if */
} /* end if */
@@ -1088,7 +1088,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const
page_entry = (H5PB_entry_t *)H5SL_search(page_buf->slist_ptr, (void *)(&search_addr));
if (page_entry) {
offset = addr - first_page_addr;
- HDassert(page_buf->page_size > offset);
+ assert(page_buf->page_size > offset);
/* Update page's data */
H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf,
@@ -1102,7 +1102,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const
/* Special handling for the last page if it is not a full page update */
else if (num_touched_pages > 1 && i == (num_touched_pages - 1) &&
(search_addr + page_buf->page_size) != (addr + size)) {
- HDassert(search_addr + page_buf->page_size > addr + size);
+ assert(search_addr + page_buf->page_size > addr + size);
/* Lookup the page in the skip list */
page_entry = (H5PB_entry_t *)H5SL_search(page_buf->slist_ptr, (void *)(&search_addr));
@@ -1141,7 +1141,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const
} /* end if */
else {
/* An access could span 1 or 2 PBs at this point so we need to handle that */
- HDassert(1 == num_touched_pages || 2 == num_touched_pages);
+ assert(1 == num_touched_pages || 2 == num_touched_pages);
for (i = 0; i < num_touched_pages; i++) {
haddr_t buf_offset;
@@ -1194,7 +1194,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const
* buffer for this I/O and we need to bypass
*/
if (0 == can_make_space) {
- HDassert(0 == i);
+ assert(0 == i);
/* Write to VFD and return */
if (H5FD_write(file, type, addr, size, buf) < 0)
@@ -1222,9 +1222,9 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const
if (NULL == (new_page_buf = H5FL_FAC_MALLOC(page_buf->page_fac)))
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTALLOC, FAIL,
"memory allocation failed for page buffer entry")
- HDmemset(new_page_buf, 0, (size_t)offset);
- HDmemset((uint8_t *)new_page_buf + offset + access_size, 0,
- page_size - ((size_t)offset + access_size));
+ memset(new_page_buf, 0, (size_t)offset);
+ memset((uint8_t *)new_page_buf + offset + access_size, 0,
+ page_size - ((size_t)offset + access_size));
page_entry->page_buf_ptr = new_page_buf;
@@ -1323,7 +1323,7 @@ H5PB_enabled(H5F_shared_t *f_sh, H5FD_mem_t type, hbool_t *enabled)
FUNC_ENTER_NOAPI_NOERR
/* Sanity checks */
- HDassert(f_sh);
+ assert(f_sh);
/* Get pointer to page buffer info for this file */
page_buf = f_sh->page_buf;
@@ -1356,7 +1356,7 @@ H5PB_enabled(H5F_shared_t *f_sh, H5FD_mem_t type, hbool_t *enabled)
* returns FALSE, the calling function performs I/O avoiding the page
* buffer layer */
if (page_buf) {
- HDassert(type == H5FD_MEM_DRAW);
+ assert(type == H5FD_MEM_DRAW);
page_buf->bypasses[1]++;
} /* end if */
@@ -1402,7 +1402,7 @@ H5PB__insert_entry(H5PB_t *page_buf, H5PB_entry_t *page_entry)
/* Insert entry in skip list */
if (H5SL_insert(page_buf->slist_ptr, page_entry, &(page_entry->addr)) < 0)
HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINSERT, FAIL, "can't insert entry in skip list")
- HDassert(H5SL_count(page_buf->slist_ptr) * page_buf->page_size <= page_buf->max_size);
+ assert(H5SL_count(page_buf->slist_ptr) * page_buf->page_size <= page_buf->max_size);
/* Increment appropriate page count */
if (H5F_MEM_PAGE_DRAW == page_entry->type || H5F_MEM_PAGE_GHEAP == page_entry->type)
@@ -1445,8 +1445,8 @@ H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type)
FUNC_ENTER_PACKAGE
/* Sanity check */
- HDassert(f_sh);
- HDassert(page_buf);
+ assert(f_sh);
+ assert(page_buf);
/* Get oldest entry */
page_entry = page_buf->LRU_tail_ptr;
@@ -1455,7 +1455,7 @@ H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type)
/* If threshould is 100% metadata and page buffer is full of
metadata, then we can't make space for raw data */
if (0 == page_buf->raw_count && page_buf->min_meta_count == page_buf->meta_count) {
- HDassert(page_buf->meta_count * page_buf->page_size == page_buf->max_size);
+ assert(page_buf->meta_count * page_buf->page_size == page_buf->max_size);
HGOTO_DONE(FALSE)
} /* end if */
@@ -1472,7 +1472,7 @@ H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type)
/* If threshould is 100% raw data and page buffer is full of
raw data, then we can't make space for meta data */
if (0 == page_buf->meta_count && page_buf->min_raw_count == page_buf->raw_count) {
- HDassert(page_buf->raw_count * page_buf->page_size == page_buf->max_size);
+ assert(page_buf->raw_count * page_buf->page_size == page_buf->max_size);
HGOTO_DONE(FALSE)
} /* end if */
@@ -1493,7 +1493,7 @@ H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type)
/* Remove entry from LRU list */
H5PB__REMOVE_LRU(page_buf, page_entry)
- HDassert(H5SL_count(page_buf->slist_ptr) == page_buf->LRU_list_len);
+ assert(H5SL_count(page_buf->slist_ptr) == page_buf->LRU_list_len);
/* Decrement appropriate page type counter */
if (H5F_MEM_PAGE_DRAW == page_entry->type || H5F_MEM_PAGE_GHEAP == page_entry->type)
@@ -1543,8 +1543,8 @@ H5PB__write_entry(H5F_shared_t *f_sh, H5PB_entry_t *page_entry)
FUNC_ENTER_PACKAGE
/* Sanity check */
- HDassert(f_sh);
- HDassert(page_entry);
+ assert(f_sh);
+ assert(page_entry);
/* Retrieve the 'eoa' for the file */
if (HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, (H5FD_mem_t)page_entry->type)))