diff options
-rw-r--r-- | src/H5F.c | 12 | ||||
-rw-r--r-- | src/H5Fpkg.h | 3 | ||||
-rw-r--r-- | src/H5Fprivate.h | 2 | ||||
-rw-r--r-- | src/H5Fquery.c | 29 | ||||
-rw-r--r-- | src/H5HFdblock.c | 10 | ||||
-rw-r--r-- | src/H5HFiblock.c | 30 |
6 files changed, 75 insertions, 11 deletions
@@ -949,13 +949,23 @@ H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf) f->shared->maxaddr = H5FD_get_maxaddr(lf); if(!H5F_addr_defined(f->shared->maxaddr)) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad maximum address from VFD") - f->shared->tmp_addr = f->shared->maxaddr; if(H5FD_get_feature_flags(lf, &f->shared->feature_flags) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get feature flags from VFD") if(H5FD_get_fs_type_map(lf, f->shared->fs_type_map) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get free space type mapping from VFD") if(H5MF_init_merge_flags(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "problem initializing free space merge flags") + f->shared->tmp_addr = f->shared->maxaddr; + /* Disable temp. space allocation for parallel I/O (for now) */ + /* (When we've arranged to have the relocated metadata addresses (and + * sizes) broadcast during the "end of epoch" metadata operations, + * this can be enabled - QAK) + */ + /* (This should be disabled when the metadata journaling branch is + * merged into the trunk and journaling is enabled, at least until + * we make it work. - QAK) + */ + f->shared->use_tmp_space = !(IS_H5FD_MPI(f)); /* Bump superblock version if we are to use the latest version of the format */ if(f->shared->latest_format) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index acc8aaf..44ded9f 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -162,9 +162,10 @@ typedef struct H5F_file_t { haddr_t root_addr; /* Root group address */ H5FO_t *open_objs; /* Open objects in file */ H5RC_t *grp_btree_shared; /* Ref-counted group B-tree node info */ - haddr_t tmp_addr; /* Next address to use for temp. space in the file */ /* File space allocation information */ + hbool_t use_tmp_space; /* Whether temp. file space allocation is allowed */ + haddr_t tmp_addr; /* Next address to use for temp. space in the file */ unsigned fs_aggr_merge[H5FD_MEM_NTYPES]; /* Flags for whether free space can merge with aggregator(s) */ H5F_fs_state_t fs_state[H5FD_MEM_NTYPES]; /* State of free space manager for each type */ haddr_t fs_addr[H5FD_MEM_NTYPES]; /* Address of free space manager info for each type */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index c7b4d25..f29b495 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -265,6 +265,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; #define H5F_HAS_FEATURE(F,FL) ((F)->shared->lf->feature_flags & (FL)) #define H5F_DRIVER_ID(F) ((F)->shared->lf->driver_id) #define H5F_GET_FILENO(F,FILENUM) ((FILENUM) = (F)->shared->lf->fileno) +#define H5F_USE_TMP_SPACE(F) ((F)->shared->use_tmp_space) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->tmp_addr, (ADDR))) #else /* H5F_PACKAGE */ #define H5F_INTENT(F) (H5F_get_intent(F)) @@ -288,6 +289,7 @@ typedef struct H5F_blk_aggr_t H5F_blk_aggr_t; #define H5F_HAS_FEATURE(F,FL) (H5F_has_feature(F,FL)) #define H5F_DRIVER_ID(F) (H5F_get_driver_id(F)) #define H5F_GET_FILENO(F,FILENUM) (H5F_get_fileno((F), &(FILENUM))) +#define H5F_USE_TMP_SPACE(F) (H5F_use_tmp_space(F)) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR))) #endif /* H5F_PACKAGE */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 5538d60..44c1b32 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -711,8 +711,35 @@ H5F_is_tmp_addr(const H5F_t *f, haddr_t addr) HDassert(f); HDassert(f->shared); - HDassert(f->shared->lf); FUNC_LEAVE_NOAPI(H5F_addr_le(f->shared->tmp_addr, addr)) } /* end H5F_is_tmp_addr() */ + +/*------------------------------------------------------------------------- + * Function: H5F_use_tmp_space + * + * Purpose: Quick and dirty routine to determine if using temporary + * file space is allowed for this file. + * (Mainly added to stop non-file routines from poking about in the + * H5F_t data structure) + * + * Return: TRUE/FALSE on success/abort on failure (shouldn't fail) + * + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * July 1, 2009 + * + *------------------------------------------------------------------------- + */ +hbool_t +H5F_use_tmp_space(const H5F_t *f) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_use_tmp_space) + + HDassert(f); + HDassert(f->shared); + + FUNC_LEAVE_NOAPI(f->shared->use_tmp_space) +} /* end H5F_use_tmp_space() */ + diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 7e68533..3a911d6 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -149,8 +149,14 @@ HDmemset(dblock->blk, 0, dblock->size); #endif /* H5_CLEAR_MEMORY */ /* Allocate [temporary] space for the direct block on disk */ - if(HADDR_UNDEF == (dblock_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)dblock->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") + if(H5F_USE_TMP_SPACE(hdr->f)) { + if(HADDR_UNDEF == (dblock_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)dblock->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") + } /* end if */ + else { + if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)dblock->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") + } /* end else */ #ifdef QAK HDfprintf(stderr, "%s: direct block address = %a\n", FUNC, dblock_addr); #endif /* QAK */ diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 3383ef9..c0fa1e4 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -600,8 +600,14 @@ HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry); iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock); /* Allocate [temporary] space for the new indirect block on disk */ - if(HADDR_UNDEF == (new_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + if(H5F_USE_TMP_SPACE(hdr->f)) { + if(HADDR_UNDEF == (new_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + } /* end if */ + else { + if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + } /* end else */ #ifdef QAK HDfprintf(stderr, "%s: Check 1.0 - iblock->addr = %a, new_addr = %a\n", FUNC, iblock->addr, new_addr); #endif /* QAK */ @@ -771,8 +777,14 @@ HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock); /* Allocate [temporary] space for the new indirect block on disk */ - if(HADDR_UNDEF == (new_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + if(H5F_USE_TMP_SPACE(hdr->f)) { + if(HADDR_UNDEF == (new_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + } /* end if */ + else { + if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + } /* end else */ #ifdef QAK HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr); #endif /* QAK */ @@ -1087,8 +1099,14 @@ HDfprintf(stderr, "%s: dir_rows = %u\n", FUNC, dir_rows); iblock->child_iblocks = NULL; /* Allocate [temporary] space for the indirect block on disk */ - if(HADDR_UNDEF == (*addr_p = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + if(H5F_USE_TMP_SPACE(hdr->f)) { + if(HADDR_UNDEF == (*addr_p = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + } /* end if */ + else { + if(HADDR_UNDEF == (*addr_p = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + } /* end else */ iblock->addr = *addr_p; /* Attach to parent indirect block, if there is one */ |