Skip to content

Commit c857f9a

Browse files
committed
Address comments from review
1 parent 1723fd6 commit c857f9a

2 files changed

Lines changed: 38 additions & 7 deletions

File tree

src/H5FDros3.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,17 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
12901290
page_buf_size = ROS3_DEF_PAGE_BUF_SIZE;
12911291
}
12921292

1293+
if (page_buf_size == 0)
1294+
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid page buffer size (0) specified");
1295+
1296+
/* Specified page buffer size should be the final say on the amount of bytes
1297+
* allocated; round page size down to page buffer size if the latter is smaller.
1298+
*/
1299+
if (page_buf_size < file->page_cache.page_size)
1300+
file->page_cache.page_size = page_buf_size;
1301+
12931302
file->page_cache.max_num_pages = (page_buf_size / file->page_cache.page_size);
1303+
assert(file->page_cache.max_num_pages >= 1);
12941304
}
12951305

12961306
#ifdef ROS3_STATS
@@ -1901,7 +1911,7 @@ H5FD__ros3_init_page_cache(H5FD_ros3_t *file)
19011911
}
19021912

19031913
FUNC_LEAVE_NOAPI(ret_value)
1904-
}
1914+
} /* end H5FD__ros3_init_page_cache() */
19051915

19061916
/*-------------------------------------------------------------------------
19071917
* Function: H5FD__ros3_determine_io_reqs
@@ -1988,7 +1998,7 @@ H5FD__ros3_determine_io_reqs(H5FD_ros3_t *file, haddr_t addr, size_t io_size,
19881998

19891999
done:
19902000
FUNC_LEAVE_NOAPI(ret_value)
1991-
} /* end H5FD__ros3_determine_io_pages() */
2001+
} /* end H5FD__ros3_determine_io_reqs() */
19922002

19932003
/*-------------------------------------------------------------------------
19942004
* Function: H5FD__ros3_page_cache_make_space

test/ros3.c

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,11 +1158,14 @@ test_hive_style_object_key(void)
11581158
static int
11591159
test_ros3_paging_apis(void)
11601160
{
1161-
size_t page_size;
1162-
size_t page_cache_size;
1163-
hid_t fid = H5I_INVALID_HID;
1164-
hid_t fapl_id = H5I_INVALID_HID;
1165-
bool lock_super_page;
1161+
unsigned page_buf_min_meta;
1162+
unsigned page_buf_min_raw;
1163+
size_t page_size;
1164+
size_t page_cache_size;
1165+
size_t page_buf_size;
1166+
hid_t fid = H5I_INVALID_HID;
1167+
hid_t fapl_id = H5I_INVALID_HID;
1168+
bool lock_super_page;
11661169

11671170
TESTING("ros3 I/O paging parameter APIs");
11681171

@@ -1242,6 +1245,24 @@ test_ros3_paging_apis(void)
12421245
if (H5Fclose(fid) < 0)
12431246
TEST_ERROR;
12441247

1248+
/* Set page buffer size to smaller than page size - should round page size down; no way to verify
1249+
* currently
1250+
*/
1251+
if (H5Pget_page_buffer_size(fapl_id, &page_buf_size, &page_buf_min_meta, &page_buf_min_raw) < 0)
1252+
TEST_ERROR;
1253+
if (H5Pset_page_buffer_size(fapl_id, HDF5_ROS3_VFD_DEFAULT_PAGE_SIZE - 1, 50, 50) < 0)
1254+
TEST_ERROR;
1255+
1256+
/* Check that parameters are accepted - no validation performed since H5FD_ros3_t fields are internal */
1257+
if ((fid = H5Fopen(url_h5_public, H5F_ACC_RDONLY, fapl_id)) < 0)
1258+
TEST_ERROR;
1259+
if (H5Fclose(fid) < 0)
1260+
TEST_ERROR;
1261+
1262+
/* Restore page buffer settings */
1263+
if (H5Pset_page_buffer_size(fapl_id, page_buf_size, page_buf_min_meta, page_buf_min_raw) < 0)
1264+
TEST_ERROR;
1265+
12451266
/* Disable locking of the superblock page into the page cache */
12461267
if (H5Pset_fapl_ros3_paging(fapl_id, 1048576, 4194304, false) < 0)
12471268
TEST_ERROR;

0 commit comments

Comments
 (0)