diff options
Diffstat (limited to 'src/H5MF.c')
-rw-r--r-- | src/H5MF.c | 87 |
1 files changed, 2 insertions, 85 deletions
@@ -215,81 +215,6 @@ done: } /*------------------------------------------------------------------------- - * Function: H5MF_reserve - * - * Purpose: Sets aside file space that has not yet been allocated, but will - * be (or might be in the worst case). This number is used to - * ensure that there is room in the file when it is flushed to disk. - * - * Nothing changes (and no error is generated) if the file is opened - * as read-only. - * - * Return: Success: 0 - * - * Failure: negative - * - * Programmer: James Laird - * Nat Furrer - * Thursday, May 27, 2004 - * - * Modifications: - *------------------------------------------------------------------------- - */ -herr_t -H5MF_reserve(H5F_t *f, hsize_t size) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(H5MF_reserve, FAIL); - - /* Check arguments */ - assert(f); - - /* Check that there is room in the file to reserve this space */ - if( H5MF_alloc_overflow( f, size ) ) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "not enough address space in file"); - - f->shared->lf->reserved_alloc += size; - -done: - FUNC_LEAVE_NOAPI(ret_value); -} - -/*------------------------------------------------------------------------- - * Function: H5MF_free_reserved - * - * Purpose: Releases the file space set aside by H5MF_reserve. This should - * be called immediately before allocating the file space for which - * the space was reserved. - * - * Return: None - * - * Programmer: James Laird - * Nat Furrer - * Thursday, May 27, 2004 - * - * Modifications: - *------------------------------------------------------------------------- - */ -herr_t -H5MF_free_reserved(H5F_t *f, hsize_t size) -{ - FUNC_ENTER_NOAPI_NOFUNC(H5MF_free_reserved) - - /* Check arguments */ - assert(f); - - /* If this assert breaks, it means that HDF5 is trying to free file space - * that was never reserved. - */ - assert(size <= f->shared->lf->reserved_alloc); - - f->shared->lf->reserved_alloc -= size; - - FUNC_LEAVE_NOAPI(SUCCEED) -} - -/*------------------------------------------------------------------------- * Function: H5MF_alloc_overflow * * Purpose: Checks if an allocation of file space would cause an overflow. @@ -329,19 +254,11 @@ H5MF_alloc_overflow(H5F_t *f, hsize_t size) /* Add the amount of space requested for this allocation */ space_needed += size; - /* Also add space that is "reserved" for data to be flushed - * to disk (e.g., for object headers and the heap). - * This is the total amount of file space that will be - * allocated. - */ - space_needed += f->shared->lf->reserved_alloc; - /* Ensure that this final number is less than the file's * address space. We do this by shifting in multiples * of 16 bits because some systems will do nothing if - * we shift by the size of a long long (64 bits) all at - * once (<cough> Linux <cough>). Thus, we break one shift - * into several smaller shifts. + * we shift by 64 bits all at once (<cough> Linux <cough>). + * Thus, we break one shift into several smaller shifts. */ for(c=0; c < H5F_SIZEOF_ADDR(f); c += 2) space_needed = space_needed >> 16; |