From 3f60cb991ab54b28df648ae25f23a25d5ca63e83 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Dec 2023 21:56:23 +0000 Subject: [PATCH] Committing clang-format changes --- src/H5FDsubfiling/H5FDioc.c | 4 +- src/H5FDsubfiling/H5FDioc_threads.c | 2 +- src/H5FDsubfiling/H5FDsubfiling.c | 283 +++++++++++++++------------- 3 files changed, 155 insertions(+), 134 deletions(-) diff --git a/src/H5FDsubfiling/H5FDioc.c b/src/H5FDsubfiling/H5FDioc.c index 0b8f703ad97..b019add4009 100644 --- a/src/H5FDsubfiling/H5FDioc.c +++ b/src/H5FDsubfiling/H5FDioc.c @@ -1748,8 +1748,8 @@ H5FD__ioc_read_vector_internal(H5FD_t *_file, uint32_t count, haddr_t addrs[], s H5_CHECK_OVERFLOW(addrs[i], haddr_t, int64_t); H5_CHECK_OVERFLOW(io_size, size_t, int64_t); - read_status = ioc__read_independent_async(sf_context_id, (int64_t)addrs[i], (int64_t)io_size, - bufs[i], &sf_io_reqs[i]); + read_status = ioc__read_independent_async(sf_context_id, (int64_t)addrs[i], (int64_t)io_size, bufs[i], + &sf_io_reqs[i]); if (read_status < 0) H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't queue read operation"); diff --git a/src/H5FDsubfiling/H5FDioc_threads.c b/src/H5FDsubfiling/H5FDioc_threads.c index 834da221f4d..85c2561549d 100644 --- a/src/H5FDsubfiling/H5FDioc_threads.c +++ b/src/H5FDsubfiling/H5FDioc_threads.c @@ -881,7 +881,7 @@ ioc_file_queue_read_indep(sf_work_request_t *msg, int ioc_idx, int source, MPI_C * tag to distinguish each I/O request. */ need_data_tag = (sf_context->sf_num_subfiles == 1) || - (sf_context->sf_num_subfiles != sf_context->topology->n_io_concentrators); + (sf_context->sf_num_subfiles != sf_context->topology->n_io_concentrators); if (!need_data_tag) send_tag = READ_INDEP_DATA; diff --git a/src/H5FDsubfiling/H5FDsubfiling.c b/src/H5FDsubfiling/H5FDsubfiling.c index e05c90ee499..9603cf4ebd9 100644 --- a/src/H5FDsubfiling/H5FDsubfiling.c +++ b/src/H5FDsubfiling/H5FDsubfiling.c @@ -195,39 +195,48 @@ static herr_t H5FD__subfiling_close_int(H5FD_subfiling_t *file_ptr); static herr_t H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_t types[], haddr_t addrs[], size_t sizes[], H5_flexible_const_ptr_t bufs[], H5FD_subfiling_io_type_t io_type); -static herr_t H5FD__subfiling_mirror_writes_to_stub(H5FD_subfiling_t *file_ptr, uint32_t count, H5FD_mem_t types[], - haddr_t addrs[], size_t sizes[], const void *bufs[]); +static herr_t H5FD__subfiling_mirror_writes_to_stub(H5FD_subfiling_t *file_ptr, uint32_t count, + H5FD_mem_t types[], haddr_t addrs[], size_t sizes[], + const void *bufs[]); static herr_t generate_io_vectors(subfiling_context_t *sf_context, size_t in_count, H5FD_mem_t types[], haddr_t file_offsets[], size_t nelemts[], H5_flexible_const_ptr_t bufs[], size_t dtype_extent, H5FD_subfiling_io_type_t io_type, size_t *ioreq_count, uint32_t *iovec_len, H5FD_mem_t **io_types, haddr_t **io_addrs, size_t **io_sizes, H5_flexible_const_ptr_t **io_bufs); -static void get_iovec_sizes(subfiling_context_t *sf_context, size_t in_count, haddr_t file_offsets[], - size_t nelemts[], size_t dtype_extent, size_t *max_iovec_depth, size_t *max_num_subfiles); -static herr_t translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, size_t iovec_len, size_t iovec_count, - H5FD_mem_t type, haddr_t addr, size_t io_size, H5_flexible_const_ptr_t io_buf, - H5FD_subfiling_io_type_t io_type, H5FD_mem_t *io_types, haddr_t *io_addrs, size_t *io_sizes, +static void get_iovec_sizes(subfiling_context_t *sf_context, size_t in_count, haddr_t file_offsets[], + size_t nelemts[], size_t dtype_extent, size_t *max_iovec_depth, + size_t *max_num_subfiles); +static herr_t translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, size_t iovec_len, + size_t iovec_count, H5FD_mem_t type, haddr_t addr, size_t io_size, + H5_flexible_const_ptr_t io_buf, H5FD_subfiling_io_type_t io_type, + H5FD_mem_t *io_types, haddr_t *io_addrs, size_t *io_sizes, H5_flexible_const_ptr_t *io_bufs); -static herr_t iovec_fill_first(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, int64_t target_datasize, - int64_t start_mem_offset, int64_t start_file_offset, int64_t first_io_len, H5_flexible_const_ptr_t buf, - H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, size_t *io_sizes_ptr, H5_flexible_const_ptr_t *io_bufs_ptr); -static herr_t iovec_fill_last(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, int64_t target_datasize, - int64_t start_mem_offset, int64_t start_file_offset, int64_t last_io_len, H5_flexible_const_ptr_t buf, - H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, size_t *io_sizes_ptr, H5_flexible_const_ptr_t *io_bufs_ptr); -static herr_t iovec_fill_first_last(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, - int64_t target_datasize, int64_t start_mem_offset, int64_t start_file_offset, - int64_t first_io_len, int64_t last_io_len, H5_flexible_const_ptr_t buf, - H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, size_t *io_sizes_ptr, - H5_flexible_const_ptr_t *io_bufs_ptr); -static herr_t iovec_fill_uniform(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, int64_t target_datasize, - int64_t start_mem_offset, int64_t start_file_offset, H5_flexible_const_ptr_t buf, - H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, size_t *io_sizes_ptr, H5_flexible_const_ptr_t *io_bufs_ptr); +static herr_t iovec_fill_first(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, + int64_t target_datasize, int64_t start_mem_offset, int64_t start_file_offset, + int64_t first_io_len, H5_flexible_const_ptr_t buf, + H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, size_t *io_sizes_ptr, + H5_flexible_const_ptr_t *io_bufs_ptr); +static herr_t iovec_fill_last(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, + int64_t target_datasize, int64_t start_mem_offset, int64_t start_file_offset, + int64_t last_io_len, H5_flexible_const_ptr_t buf, + H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, size_t *io_sizes_ptr, + H5_flexible_const_ptr_t *io_bufs_ptr); +static herr_t iovec_fill_first_last(subfiling_context_t *sf_context, size_t iovec_len, + int64_t cur_iovec_depth, int64_t target_datasize, + int64_t start_mem_offset, int64_t start_file_offset, int64_t first_io_len, + int64_t last_io_len, H5_flexible_const_ptr_t buf, + H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, + size_t *io_sizes_ptr, H5_flexible_const_ptr_t *io_bufs_ptr); +static herr_t iovec_fill_uniform(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, + int64_t target_datasize, int64_t start_mem_offset, int64_t start_file_offset, + H5_flexible_const_ptr_t buf, H5FD_subfiling_io_type_t io_type, + haddr_t *io_addrs_ptr, size_t *io_sizes_ptr, + H5_flexible_const_ptr_t *io_bufs_ptr); #ifdef H5_SUBFILING_DEBUG -void -H5_subfiling_dump_iovecs(subfiling_context_t *sf_context, size_t ioreq_count, size_t iovec_len, - H5FD_subfiling_io_type_t io_type, H5FD_mem_t *io_types, haddr_t *io_addrs, - size_t *io_sizes, H5_flexible_const_ptr_t *io_bufs); +void H5_subfiling_dump_iovecs(subfiling_context_t *sf_context, size_t ioreq_count, size_t iovec_len, + H5FD_subfiling_io_type_t io_type, H5FD_mem_t *io_types, haddr_t *io_addrs, + size_t *io_sizes, H5_flexible_const_ptr_t *io_bufs); #endif void H5FD__subfiling_mpi_finalize(void); @@ -2044,20 +2053,19 @@ H5FD__subfiling_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *------------------------------------------------------------------------- */ static herr_t -H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_t types[], - haddr_t addrs[], size_t sizes[], H5_flexible_const_ptr_t bufs[], - H5FD_subfiling_io_type_t io_type) +H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_t types[], haddr_t addrs[], + size_t sizes[], H5_flexible_const_ptr_t bufs[], H5FD_subfiling_io_type_t io_type) { - H5_flexible_const_ptr_t *io_bufs = NULL; - subfiling_context_t *sf_context = NULL; - H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_INDEPENDENT; - H5FD_mem_t *io_types = NULL; - haddr_t *io_addrs = NULL; - size_t *io_sizes = NULL; - haddr_t file_eoa = HADDR_UNDEF; - size_t io_size = 0; - bool rank0_bcast = false; - bool extend_sizes = false; + H5_flexible_const_ptr_t *io_bufs = NULL; + subfiling_context_t *sf_context = NULL; + H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_INDEPENDENT; + H5FD_mem_t *io_types = NULL; + haddr_t *io_addrs = NULL; + size_t *io_sizes = NULL; + haddr_t file_eoa = HADDR_UNDEF; + size_t io_size = 0; + bool rank0_bcast = false; + bool extend_sizes = false; int num_subfiles; herr_t ret_value = SUCCEED; @@ -2080,15 +2088,16 @@ H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_ } if (!H5_addr_defined(addrs[i])) - H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "addr[%zu] undefined, addr = %" PRIuHADDR, i, addrs[i]); + H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr[%zu] undefined, addr = %" PRIuHADDR, + i, addrs[i]); if (REGION_OVERFLOW(addrs[i], io_size)) H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, - "addr[%zu] overflow, addr = %" PRIuHADDR ", size = %zu", - i, addrs[i], io_size); + "addr[%zu] overflow, addr = %" PRIuHADDR ", size = %zu", i, addrs[i], + io_size); if ((addrs[i] + io_size) > file_eoa) H5_SUBFILING_GOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, - "addr overflow, addrs[%zu] = %" PRIuHADDR ", sizes[%zu] = %zu, eoa = %" PRIuHADDR, + "addr overflow, addrs[%zu] = %" PRIuHADDR + ", sizes[%zu] = %zu, eoa = %" PRIuHADDR, i, addrs[i], i, io_size, file_eoa); } @@ -2098,8 +2107,7 @@ H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_ * can be properly handled here. */ if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) - H5_SUBFILING_GOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, - "can't determine I/O collectivity setting"); + H5_SUBFILING_GOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't determine I/O collectivity setting"); if (xfer_mode == H5FD_MPIO_COLLECTIVE) { MPI_Datatype btype, ftype; @@ -2107,8 +2115,7 @@ H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_ if (H5CX_get_mpi_coll_datatypes(&btype, &ftype) < 0) H5_SUBFILING_GOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't get MPI-I/O datatypes"); if (MPI_BYTE != btype || MPI_BYTE != ftype) - H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, - "collective I/O is currently unsupported"); + H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "collective I/O is currently unsupported"); } /* @@ -2134,7 +2141,8 @@ H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_ * underlying I/O operations. */ if (NULL == (sf_context = (subfiling_context_t *)H5_get_subfiling_object(file_ptr->context_id))) - H5_SUBFILING_GOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "invalid or missing subfiling context object"); + H5_SUBFILING_GOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, + "invalid or missing subfiling context object"); assert(sf_context->topology); if ((num_subfiles = sf_context->sf_num_subfiles) <= 0) @@ -2157,7 +2165,8 @@ H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_ if (io_type == IO_TYPE_WRITE) { /* Make vector write call to VFD controlling subfiles */ - if (H5FD_write_vector(file_ptr->sf_file, u32_io_count, types, addrs, sizes, (const void **)bufs) < 0) + if (H5FD_write_vector(file_ptr->sf_file, u32_io_count, types, addrs, sizes, (const void **)bufs) < + 0) H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to subfile failed"); /* @@ -2165,7 +2174,8 @@ H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_ * legacy HDF5 applications can check what type of * file they are reading */ - if (H5FD__subfiling_mirror_writes_to_stub(file_ptr, u32_io_count, types, addrs, sizes, (const void **)bufs) < 0) + if (H5FD__subfiling_mirror_writes_to_stub(file_ptr, u32_io_count, types, addrs, sizes, + (const void **)bufs) < 0) H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mirrored write to stub file failed"); } else { @@ -2187,20 +2197,21 @@ H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_ * Generate the types, addrs, sizes and bufs I/O vectors for * this I/O request. */ - status = generate_io_vectors(sf_context, /* IN: Subfiling context used to look up config info */ - io_count, /* IN: Number of entries in `types`, `addrs`, `sizes` and `bufs` */ - types, /* IN: Array of memory types */ - addrs, /* IN: Array of starting file offsets */ - sizes, /* IN: Array of I/O sizes (in terms of elements) */ - bufs, /* IN: Array of I/O buffers */ - 1, /* IN: Data extent of the 'type'; byte is assumed currently */ - io_type, /* IN: Type of I/O being performed (IO_TYPE_WRITE or IO_TYPE_READ) */ - &ioreq_count, /* OUT: Number of I/O requests to be made */ - &iovec_len, /* OUT: Number of elements in I/O vector for a single I/O request */ - &io_types, /* OUT: I/O vector of memory types for each I/O entry */ - &io_addrs, /* OUT: I/O vector of file addresses for each I/O entry */ - &io_sizes, /* OUT: I/O vector of I/O sizes for each I/O entry */ - &io_bufs); /* OUT: I/O vector of buffers for each I/O entry */ + status = generate_io_vectors( + sf_context, /* IN: Subfiling context used to look up config info */ + io_count, /* IN: Number of entries in `types`, `addrs`, `sizes` and `bufs` */ + types, /* IN: Array of memory types */ + addrs, /* IN: Array of starting file offsets */ + sizes, /* IN: Array of I/O sizes (in terms of elements) */ + bufs, /* IN: Array of I/O buffers */ + 1, /* IN: Data extent of the 'type'; byte is assumed currently */ + io_type, /* IN: Type of I/O being performed (IO_TYPE_WRITE or IO_TYPE_READ) */ + &ioreq_count, /* OUT: Number of I/O requests to be made */ + &iovec_len, /* OUT: Number of elements in I/O vector for a single I/O request */ + &io_types, /* OUT: I/O vector of memory types for each I/O entry */ + &io_addrs, /* OUT: I/O vector of file addresses for each I/O entry */ + &io_sizes, /* OUT: I/O vector of I/O sizes for each I/O entry */ + &io_bufs); /* OUT: I/O vector of buffers for each I/O entry */ if (status < 0) H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "can't initialize I/O vectors"); @@ -2216,8 +2227,8 @@ H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_ H5_SUBFILING_GOTO_DONE(SUCCEED); #ifdef H5_SUBFILING_DEBUG - H5_subfiling_dump_iovecs(sf_context, ioreq_count, iovec_len, io_type, - io_types, io_addrs, io_sizes, io_bufs); + H5_subfiling_dump_iovecs(sf_context, ioreq_count, iovec_len, io_type, io_types, io_addrs, io_sizes, + io_bufs); #endif /* clang-format off */ @@ -2281,7 +2292,8 @@ H5FD__subfiling_io_helper(H5FD_subfiling_t *file_ptr, size_t io_count, H5FD_mem_ */ if (H5FD__subfiling_mirror_writes_to_stub(file_ptr, final_vec_len, io_types_ptr, io_addrs_ptr, io_sizes_ptr, (const void **)io_bufs_ptr) < 0) - H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mirrored write to stub file failed"); + H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, + "mirrored write to stub file failed"); } else { if (!rank0_bcast || (file_ptr->mpi_rank == 0)) { @@ -2401,13 +2413,17 @@ H5FD__subfiling_mirror_writes_to_stub(H5FD_subfiling_t *file_ptr, uint32_t count /* Copy I/O vectors and strip out non-superblock I/O */ if (NULL == (copied_types = malloc(count * sizeof(*copied_types)))) - H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate copy of I/O types array"); + H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "can't allocate copy of I/O types array"); if (NULL == (copied_addrs = malloc(count * sizeof(*copied_addrs)))) - H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate copy of I/O addresses array"); + H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "can't allocate copy of I/O addresses array"); if (NULL == (copied_sizes = malloc(count * sizeof(*copied_sizes)))) - H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate copy of I/O sizes array"); + H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "can't allocate copy of I/O sizes array"); if (NULL == (copied_bufs = malloc(count * sizeof(*copied_bufs)))) - H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate copy of I/O buffers array"); + H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "can't allocate copy of I/O buffers array"); extend_types = false; extend_sizes = false; @@ -2547,8 +2563,8 @@ static herr_t generate_io_vectors(subfiling_context_t *sf_context, size_t in_count, H5FD_mem_t types[], haddr_t file_offsets[], size_t nelemts[], H5_flexible_const_ptr_t bufs[], size_t dtype_extent, H5FD_subfiling_io_type_t io_type, size_t *ioreq_count, - uint32_t *iovec_len, H5FD_mem_t **io_types, haddr_t **io_addrs, - size_t **io_sizes, H5_flexible_const_ptr_t **io_bufs) + uint32_t *iovec_len, H5FD_mem_t **io_types, haddr_t **io_addrs, size_t **io_sizes, + H5_flexible_const_ptr_t **io_bufs) { H5_flexible_const_ptr_t *loc_io_bufs = NULL; H5FD_mem_t *loc_io_types = NULL; @@ -2593,26 +2609,29 @@ generate_io_vectors(subfiling_context_t *sf_context, size_t in_count, H5FD_mem_t * I/O vectors we will need to allocate to satisfy the * entire I/O request */ - get_iovec_sizes(sf_context, in_count, file_offsets, nelemts, dtype_extent, - &max_iovec_depth, &max_num_subfiles_touched); + get_iovec_sizes(sf_context, in_count, file_offsets, nelemts, dtype_extent, &max_iovec_depth, + &max_num_subfiles_touched); tot_iovec_len = in_count * max_iovec_depth * max_num_subfiles_touched; #ifdef H5_SUBFILING_DEBUG - H5_subfiling_log(sf_context->sf_context_id, - "%s: I/O count: %zu, max_iovec_depth = %zu, max_num_subfiles_touched = %zu, iovec_len = %zu", - __func__, in_count, max_iovec_depth, max_num_subfiles_touched, tot_iovec_len); + H5_subfiling_log( + sf_context->sf_context_id, + "%s: I/O count: %zu, max_iovec_depth = %zu, max_num_subfiles_touched = %zu, iovec_len = %zu", + __func__, in_count, max_iovec_depth, max_num_subfiles_touched, tot_iovec_len); #endif /* Allocate I/O vectors that will be returned to the caller */ if (NULL == (loc_io_types = calloc(1, tot_iovec_len * sizeof(*loc_io_types)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O types vector"); if (NULL == (loc_io_addrs = calloc(1, tot_iovec_len * sizeof(*loc_io_addrs)))) - H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O addresses vector"); + H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "can't allocate subfile I/O addresses vector"); if (NULL == (loc_io_sizes = calloc(1, tot_iovec_len * sizeof(*loc_io_sizes)))) H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O sizes vector"); if (NULL == (loc_io_bufs = calloc(1, tot_iovec_len * sizeof(*loc_io_bufs)))) - H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate subfile I/O buffers vector"); + H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "can't allocate subfile I/O buffers vector"); /* * Populate the I/O vectors by looping through each @@ -2653,10 +2672,10 @@ generate_io_vectors(subfiling_context_t *sf_context, size_t in_count, H5FD_mem_t *ioreq_count = in_count * max_iovec_depth; H5_CHECK_OVERFLOW(max_num_subfiles_touched, size_t, uint32_t); *iovec_len = (uint32_t)max_num_subfiles_touched; - *io_types = loc_io_types; - *io_addrs = loc_io_addrs; - *io_sizes = loc_io_sizes; - *io_bufs = loc_io_bufs; + *io_types = loc_io_types; + *io_addrs = loc_io_addrs; + *io_sizes = loc_io_sizes; + *io_bufs = loc_io_bufs; done: if (ret_value < 0) { @@ -2684,8 +2703,8 @@ generate_io_vectors(subfiling_context_t *sf_context, size_t in_count, H5FD_mem_t *------------------------------------------------------------------------- */ static void -get_iovec_sizes(subfiling_context_t *sf_context, size_t in_count, haddr_t file_offsets[], - size_t nelemts[], size_t dtype_extent, size_t *max_iovec_depth, size_t *max_num_subfiles) +get_iovec_sizes(subfiling_context_t *sf_context, size_t in_count, haddr_t file_offsets[], size_t nelemts[], + size_t dtype_extent, size_t *max_iovec_depth, size_t *max_num_subfiles) { int64_t stripe_size = 0; int64_t block_size = 0; @@ -2757,7 +2776,7 @@ get_iovec_sizes(subfiling_context_t *sf_context, size_t in_count, haddr_t file_o */ row_stripe_idx_start = stripe_idx - first_subfile; row_stripe_idx_final = final_stripe_idx - last_subfile; - cur_iovec_depth = (size_t)((row_stripe_idx_final - row_stripe_idx_start) / num_subfiles) + 1; + cur_iovec_depth = (size_t)((row_stripe_idx_final - row_stripe_idx_start) / num_subfiles) + 1; /* * If the I/O request "wrapped around" and ends in a subfile @@ -2893,9 +2912,10 @@ get_iovec_sizes(subfiling_context_t *sf_context, size_t in_count, haddr_t file_o *------------------------------------------------------------------------- */ static herr_t -translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, size_t iovec_len, size_t iovec_count, - H5FD_mem_t type, haddr_t addr, size_t io_size, H5_flexible_const_ptr_t io_buf, - H5FD_subfiling_io_type_t io_type, H5FD_mem_t *io_types, haddr_t *io_addrs, size_t *io_sizes, +translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, size_t iovec_len, + size_t iovec_count, H5FD_mem_t type, haddr_t addr, size_t io_size, + H5_flexible_const_ptr_t io_buf, H5FD_subfiling_io_type_t io_type, + H5FD_mem_t *io_types, haddr_t *io_addrs, size_t *io_sizes, H5_flexible_const_ptr_t *io_bufs) { int64_t stripe_idx = 0; @@ -3017,7 +3037,7 @@ translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, siz */ row_stripe_idx_start = stripe_idx - first_subfile_idx; row_stripe_idx_final = final_stripe_idx - last_subfile_idx; - max_iovec_depth = ((row_stripe_idx_final - row_stripe_idx_start) / num_subfiles) + 1; + max_iovec_depth = ((row_stripe_idx_final - row_stripe_idx_start) / num_subfiles) + 1; /* * If the I/O request "wrapped around" and ends in a subfile @@ -3052,14 +3072,17 @@ translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, siz max_iovec_depth--; #ifdef H5_SUBFILING_DEBUG - H5_subfiling_log(sf_context->sf_context_id, - "%s: TRANSLATING I/O REQUEST (MEMORY TYPE: %d, ADDR: %" PRIuHADDR ", I/O SIZE: %zu, BUF: %p)\n" - "STRIPE SIZE: %" PRId64 ", BLOCK SIZE: %" PRId64 ", NUM SUBFILES: %d\n" - "STRIPE IDX: %" PRId64 ", LAST STRIPE IDX: %" PRId64", FIRST SUBFILE IDX: %" PRId64 ", LAST SUBFILE IDX: %" PRId64 "\n" - "START SEGMENT LENGTH: %" PRId64 ", LAST SEGMENT LENGTH: %" PRId64 ", MAX IOVEC DEPTH: %" PRId64, - __func__, type, addr, io_size, (io_type == IO_TYPE_WRITE) ? (const void *)io_buf.cvp : (void *)io_buf.vp, - stripe_size, block_size, num_subfiles, stripe_idx, final_stripe_idx, first_subfile_idx, last_subfile_idx, - start_length, final_length, max_iovec_depth); + H5_subfiling_log( + sf_context->sf_context_id, + "%s: TRANSLATING I/O REQUEST (MEMORY TYPE: %d, ADDR: %" PRIuHADDR ", I/O SIZE: %zu, BUF: %p)\n" + "STRIPE SIZE: %" PRId64 ", BLOCK SIZE: %" PRId64 ", NUM SUBFILES: %d\n" + "STRIPE IDX: %" PRId64 ", LAST STRIPE IDX: %" PRId64 ", FIRST SUBFILE IDX: %" PRId64 + ", LAST SUBFILE IDX: %" PRId64 "\n" + "START SEGMENT LENGTH: %" PRId64 ", LAST SEGMENT LENGTH: %" PRId64 ", MAX IOVEC DEPTH: %" PRId64, + __func__, type, addr, io_size, + (io_type == IO_TYPE_WRITE) ? (const void *)io_buf.cvp : (void *)io_buf.vp, stripe_size, block_size, + num_subfiles, stripe_idx, final_stripe_idx, first_subfile_idx, last_subfile_idx, start_length, + final_length, max_iovec_depth); #endif /* @@ -3134,8 +3157,8 @@ translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, siz * subfile with the first data segment and the current * subfile index falls between the two. */ - thin_uniform_section = - thin_uniform_section || ((last_subfile_idx < subfile_idx) && (subfile_idx < first_subfile_idx)); + thin_uniform_section = thin_uniform_section || ((last_subfile_idx < subfile_idx) && + (subfile_idx < first_subfile_idx)); } if (thin_uniform_section) { @@ -3193,9 +3216,9 @@ translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, siz * I/O. In this case, we may have to deal with partial * stripe I/O in the first and last I/O segments. */ - if (iovec_fill_first_last(sf_context, iovec_len, iovec_depth, subfile_bytes, - mem_offset, cur_file_offset, start_length, final_length, - io_buf, io_type, _io_addrs_ptr, _io_sizes_ptr, _io_bufs_ptr) < 0) + if (iovec_fill_first_last(sf_context, iovec_len, iovec_depth, subfile_bytes, mem_offset, + cur_file_offset, start_length, final_length, io_buf, io_type, + _io_addrs_ptr, _io_sizes_ptr, _io_bufs_ptr) < 0) H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "can't fill I/O vectors"); } else { @@ -3261,8 +3284,7 @@ translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, siz } if (total_bytes != io_size) - H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, - "total bytes (%zu) didn't match data size (%zu)!", + H5_SUBFILING_GOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "total bytes (%zu) didn't match data size (%zu)!", total_bytes, io_size); done: @@ -3289,10 +3311,10 @@ translate_io_req_to_iovec(subfiling_context_t *sf_context, size_t iovec_idx, siz *------------------------------------------------------------------------- */ static herr_t -iovec_fill_first(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, int64_t target_datasize, - int64_t start_mem_offset, int64_t start_file_offset, int64_t first_io_len, - H5_flexible_const_ptr_t buf, H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, - size_t *io_sizes_ptr, H5_flexible_const_ptr_t *io_bufs_ptr) +iovec_fill_first(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, + int64_t target_datasize, int64_t start_mem_offset, int64_t start_file_offset, + int64_t first_io_len, H5_flexible_const_ptr_t buf, H5FD_subfiling_io_type_t io_type, + haddr_t *io_addrs_ptr, size_t *io_sizes_ptr, H5_flexible_const_ptr_t *io_bufs_ptr) { int64_t stripe_size; int64_t block_size; @@ -3386,10 +3408,10 @@ iovec_fill_first(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_ *------------------------------------------------------------------------- */ static herr_t -iovec_fill_last(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, int64_t target_datasize, - int64_t start_mem_offset, int64_t start_file_offset, int64_t last_io_len, - H5_flexible_const_ptr_t buf, H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, - size_t *io_sizes_ptr, H5_flexible_const_ptr_t *io_bufs_ptr) +iovec_fill_last(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, + int64_t target_datasize, int64_t start_mem_offset, int64_t start_file_offset, + int64_t last_io_len, H5_flexible_const_ptr_t buf, H5FD_subfiling_io_type_t io_type, + haddr_t *io_addrs_ptr, size_t *io_sizes_ptr, H5_flexible_const_ptr_t *io_bufs_ptr) { int64_t stripe_size; int64_t block_size; @@ -3511,10 +3533,11 @@ iovec_fill_last(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_i *------------------------------------------------------------------------- */ static herr_t -iovec_fill_first_last(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, int64_t target_datasize, - int64_t start_mem_offset, int64_t start_file_offset, int64_t first_io_len, int64_t last_io_len, - H5_flexible_const_ptr_t buf, H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, - size_t *io_sizes_ptr, H5_flexible_const_ptr_t *io_bufs_ptr) +iovec_fill_first_last(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, + int64_t target_datasize, int64_t start_mem_offset, int64_t start_file_offset, + int64_t first_io_len, int64_t last_io_len, H5_flexible_const_ptr_t buf, + H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, size_t *io_sizes_ptr, + H5_flexible_const_ptr_t *io_bufs_ptr) { int64_t stripe_size; int64_t block_size; @@ -3622,10 +3645,10 @@ iovec_fill_first_last(subfiling_context_t *sf_context, size_t iovec_len, int64_t *------------------------------------------------------------------------- */ static herr_t -iovec_fill_uniform(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, int64_t target_datasize, - int64_t start_mem_offset, int64_t start_file_offset, H5_flexible_const_ptr_t buf, - H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, size_t *io_sizes_ptr, - H5_flexible_const_ptr_t *io_bufs_ptr) +iovec_fill_uniform(subfiling_context_t *sf_context, size_t iovec_len, int64_t cur_iovec_depth, + int64_t target_datasize, int64_t start_mem_offset, int64_t start_file_offset, + H5_flexible_const_ptr_t buf, H5FD_subfiling_io_type_t io_type, haddr_t *io_addrs_ptr, + size_t *io_sizes_ptr, H5_flexible_const_ptr_t *io_bufs_ptr) { int64_t stripe_size; int64_t block_size; @@ -3684,7 +3707,7 @@ iovec_fill_uniform(subfiling_context_t *sf_context, size_t iovec_len, int64_t cu H5_subfiling_log(sf_context->sf_context_id, "%s: mem_offset[%zu] = %" PRId64 ", file_offset[%zu] = %" PRId64 ", io_block_len[%zu] = %" PRId64, - __func__, i,next_mem_offset, i, next_file_offset, i, stripe_size); + __func__, i, next_mem_offset, i, next_file_offset, i, stripe_size); #endif next_mem_offset += block_size; @@ -3725,14 +3748,12 @@ H5_subfiling_dump_iovecs(subfiling_context_t *sf_context, size_t ioreq_count, si if (i > 0) H5_subfiling_log_nonewline(sf_context->sf_context_id, ", "); - H5_subfiling_log_nonewline(sf_context->sf_context_id, - "(%d, %" PRIuHADDR ", %zu, %p)", - *(io_types + (ioreq_idx * iovec_len) + i), - *(io_addrs + (ioreq_idx * iovec_len) + i), - *(io_sizes + (ioreq_idx * iovec_len) + i), - (io_type == IO_TYPE_WRITE) ? - (const void *)(io_bufs + (ioreq_idx * iovec_len) + i)->cvp : - (void *)(io_bufs + (ioreq_idx * iovec_len) + i)->vp); + H5_subfiling_log_nonewline( + sf_context->sf_context_id, "(%d, %" PRIuHADDR ", %zu, %p)", + *(io_types + (ioreq_idx * iovec_len) + i), *(io_addrs + (ioreq_idx * iovec_len) + i), + *(io_sizes + (ioreq_idx * iovec_len) + i), + (io_type == IO_TYPE_WRITE) ? (const void *)(io_bufs + (ioreq_idx * iovec_len) + i)->cvp + : (void *)(io_bufs + (ioreq_idx * iovec_len) + i)->vp); } H5_subfiling_log_nonewline(sf_context->sf_context_id, "]\n"); }