diff options
-rw-r--r-- | src/H5F.c | 13 | ||||
-rw-r--r-- | src/H5FDcore.c | 15 | ||||
-rw-r--r-- | src/H5FDdirect.c | 15 | ||||
-rw-r--r-- | src/H5FDlog.c | 15 | ||||
-rw-r--r-- | src/H5FDmpiposix.c | 15 | ||||
-rw-r--r-- | src/H5FDsec2.c | 15 | ||||
-rw-r--r-- | src/H5FDstdio.c | 18 | ||||
-rw-r--r-- | src/H5FDwindows.c | 15 |
8 files changed, 100 insertions, 21 deletions
@@ -1314,19 +1314,6 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t d if(H5F_super_read(file, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock") - /* Check if the file is open for SWMR read access */ - if(flags & H5F_ACC_SWMR_READ) { - /* If the file is open for SWMR read access, adjust the end of the - * allocated space (the 'eoa') to allow access to any address in the - * file. This is done because the eoa stored in the file's superblock - * might be out of sync with the objects being written within the - * file by the application performing SWMR write operations. - */ - /* (Account for the stored EOA being absolute offset -NAF) */ - if(H5FD_set_eoa(lf, H5FD_MEM_SUPER, (file->shared->maxaddr - file->shared->sblock->base_addr)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't relax 'eoa' for SWMR read access") - } /* end if */ - /* Open the root group */ if(H5G_mkroot(file, dxpl_id, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group") diff --git a/src/H5FDcore.c b/src/H5FDcore.c index a08abdd..bd77199 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -53,6 +53,9 @@ typedef struct H5FD_core_t { hbool_t backing_store; /*write to file name on flush */ int fd; /*backing store file descriptor */ hbool_t dirty; /*changes not saved? */ + + /* Information from file open flags, for SWMR access */ + hbool_t swmr_read; /* Whether the file is open for SWMR read access */ } H5FD_core_t; /* Driver-specific file access properties */ @@ -464,6 +467,10 @@ H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id, } } + /* Check for SWMR reader access */ + if(flags & H5F_ACC_SWMR_READ) + file->swmr_read = TRUE; + /* Set return value */ ret_value=(H5FD_t *)file; @@ -782,7 +789,13 @@ H5FD_core_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd HGOTO_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed") if (REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed") - if (addr + size > file->eoa) + /* If the file is open for SWMR read access, allow access to data past + * the end of the allocated space (the 'eoa'). This is done because the + * eoa stored in the file's superblock might be out of sync with the + * objects being written within the file by the application performing + * SWMR write operations. + */ + if((addr + size) > file->eoa) HGOTO_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed") /* Read the part which is before the EOF marker */ diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index fff31f3..4d87dde 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -101,6 +101,9 @@ typedef struct H5FD_direct_t { DWORD fileindexlo; DWORD fileindexhi; #endif + + /* Information from file open flags, for SWMR access */ + hbool_t swmr_read; /* Whether the file is open for SWMR read access */ } H5FD_direct_t; /* @@ -596,6 +599,10 @@ H5FD_direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxadd if(buf2) HDfree(buf2); + /* Check for SWMR reader access */ + if(flags & H5F_ACC_SWMR_READ) + file->swmr_read = TRUE; + /* Set return value */ ret_value=(H5FD_t*)file; @@ -928,7 +935,13 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, ha HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") if (REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") - if (addr+size>file->eoa) + /* If the file is open for SWMR read access, allow access to data past + * the end of the allocated space (the 'eoa'). This is done because the + * eoa stored in the file's superblock might be out of sync with the + * objects being written within the file by the application performing + * SWMR write operations. + */ + if(!file->swmr_read && (addr + size) > file->eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") /* If the system doesn't require data to be aligned, read the data in diff --git a/src/H5FDlog.c b/src/H5FDlog.c index f7eb349..906e73a 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -115,6 +115,9 @@ typedef struct H5FD_log_t { DWORD fileindexlo; DWORD fileindexhi; #endif + + /* Information from file open flags, for SWMR access */ + hbool_t swmr_read; /* Whether the file is open for SWMR read access */ } H5FD_log_t; @@ -584,6 +587,10 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, file->logfp = stderr; } /* end if */ + /* Check for SWMR reader access */ + if(flags & H5F_ACC_SWMR_READ) + file->swmr_read = TRUE; + /* Set return value */ ret_value = (H5FD_t*)file; @@ -1057,7 +1064,13 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t addr HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") if (REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") - if (addr+size>file->eoa) + /* If the file is open for SWMR read access, allow access to data past + * the end of the allocated space (the 'eoa'). This is done because the + * eoa stored in the file's superblock might be out of sync with the + * objects being written within the file by the application performing + * SWMR write operations. + */ + if(!file->swmr_read && (addr + size) > file->eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") /* Log the I/O information about the read */ diff --git a/src/H5FDmpiposix.c b/src/H5FDmpiposix.c index ff5b118..14947a8 100644 --- a/src/H5FDmpiposix.c +++ b/src/H5FDmpiposix.c @@ -119,6 +119,9 @@ typedef struct H5FD_mpiposix_t { int fileindexlo; int fileindexhi; #endif + + /* Information from file open flags, for SWMR access */ + hbool_t swmr_read; /* Whether the file is open for SWMR read access */ } H5FD_mpiposix_t; /* @@ -785,6 +788,10 @@ H5FD_mpiposix_open(const char *name, unsigned flags, hid_t fapl_id, file->inode = sb.st_ino; #endif + /* Check for SWMR reader access */ + if(flags & H5F_ACC_SWMR_READ) + file->swmr_read = TRUE; + /* Indicate success */ ret_value=(H5FD_t *)file; @@ -1131,7 +1138,13 @@ H5FD_mpiposix_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") if (REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") - if (addr+size>file->eoa) + /* If the file is open for SWMR read access, allow access to data past + * the end of the allocated space (the 'eoa'). This is done because the + * eoa stored in the file's superblock might be out of sync with the + * objects being written within the file by the application performing + * SWMR write operations. + */ + if(!file->swmr_read && (addr + size) > file->eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") #ifdef REPORT_IO diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index c2d74a9..54f0d03 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -91,6 +91,9 @@ typedef struct H5FD_sec2_t { DWORD fileindexhi; #endif + /* Information from file open flags, for SWMR access */ + hbool_t swmr_read; /* Whether the file is open for SWMR read access */ + /* Information from properties set by 'h5repart' tool */ hbool_t fam_to_sec2; /* Whether to eliminate the family driver info * and convert this file to a single file */ @@ -391,6 +394,10 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) #endif + /* Check for SWMR reader access */ + if(flags & H5F_ACC_SWMR_READ) + file->swmr_read = TRUE; + /* Check for non-default FAPL */ if(H5P_FILE_ACCESS_DEFAULT != fapl_id) { H5P_genplist_t *plist; /* Property list pointer */ @@ -816,7 +823,13 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") if(REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") - if((addr + size) > file->eoa) + /* If the file is open for SWMR read access, allow access to data past + * the end of the allocated space (the 'eoa'). This is done because the + * eoa stored in the file's superblock might be out of sync with the + * objects being written within the file by the application performing + * SWMR write operations. + */ + if(!file->swmr_read && (addr + size) > file->eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") /* Seek to the correct location */ diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index 193c576..2070b1a 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -111,6 +111,9 @@ typedef struct H5FD_stdio_t { DWORD fileindexlo; DWORD fileindexhi; #endif + + /* Information from file open flags, for SWMR access */ + hbool_t swmr_read; /* Whether the file is open for SWMR read access */ } H5FD_stdio_t; #ifdef H5_HAVE_LSEEK64 @@ -410,6 +413,11 @@ H5FD_stdio_open( const char *name, unsigned flags, hid_t fapl_id, file->device = sb.st_dev; file->inode = sb.st_ino; #endif + + /* Check for SWMR reader access */ + if(flags & H5F_ACC_SWMR_READ) + file->swmr_read = 1; + return((H5FD_t*)file); } /* end H5FD_stdio_open() */ @@ -789,8 +797,14 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1) if (REGION_OVERFLOW(addr, size)) H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1) - if (addr+size>file->eoa) - H5Epush_ret (func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1) + /* If the file is open for SWMR read access, allow access to data past + * the end of the allocated space (the 'eoa'). This is done because the + * eoa stored in the file's superblock might be out of sync with the + * objects being written within the file by the application performing + * SWMR write operations. + */ + if(!file->swmr_read && (addr + size) > file->eoa) + H5Epush_ret(func, H5E_ERR_CLS, H5E_IO, H5E_OVERFLOW, "file address overflowed", -1) /* Check easy cases */ if (0 == size) diff --git a/src/H5FDwindows.c b/src/H5FDwindows.c index aca03c8..efdd0ba 100644 --- a/src/H5FDwindows.c +++ b/src/H5FDwindows.c @@ -93,6 +93,9 @@ typedef struct H5FD_windows_t { DWORD fileindexhi; DWORD volumeserialnumber; + /* Information from file open flags, for SWMR access */ + hbool_t swmr_read; /* Whether the file is open for SWMR read access */ + /* Information from properties set by 'h5repart' tool */ hbool_t fam_to_sec2; /* Whether to eliminate the family driver info * and convert this file to a single file */ @@ -413,6 +416,10 @@ H5FD_windows_open(const char *name, unsigned flags, hid_t UNUSED fapl_id, file->fileindexlo = fileinfo.nFileIndexLow; file->volumeserialnumber = fileinfo.dwVolumeSerialNumber; + /* Check for SWMR reader access */ + if(flags & H5F_ACC_SWMR_READ) + file->swmr_read = TRUE; + /* Check for non-default FAPL */ if(H5P_FILE_ACCESS_DEFAULT != fapl_id) { H5P_genplist_t *plist; /* Property list pointer */ @@ -799,7 +806,13 @@ H5FD_windows_read(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, h HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") if (REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") - if (addr+size>file->eoa) + /* If the file is open for SWMR read access, allow access to data past + * the end of the allocated space (the 'eoa'). This is done because the + * eoa stored in the file's superblock might be out of sync with the + * objects being written within the file by the application performing + * SWMR write operations. + */ + if(!file->swmr_read && (addr + size) > file->eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") /* Seek to the correct location */ |