[svn-r12692] Removed code that was used to support lazy allocation of file space

since HDF5 no longer allocates file space lazily.

Tested on mir; should be only a cleanup, since the code isn't called from
anywhere.
This commit is contained in:
James Laird 2006-09-28 14:36:25 -05:00
parent 3289dc5a18
commit 71ba8671b3
4 changed files with 2 additions and 89 deletions

View File

@ -1048,7 +1048,6 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver")
file->cls = driver;
file->maxaddr = maxaddr;
file->reserved_alloc = 0;
HDmemset(file->fl, 0, sizeof(file->fl));
if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(meta_block_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get meta data block size")

View File

@ -219,7 +219,6 @@ struct H5FD_t {
unsigned long feature_flags; /* VFL Driver feature Flags */
hsize_t threshold; /* Threshold for alignment */
hsize_t alignment; /* Allocation alignment */
hsize_t reserved_alloc; /* Space reserved for later alloc calls */
/* Metadata aggregation fields */
hsize_t def_meta_block_size; /* Metadata allocation

View File

@ -214,81 +214,6 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
}
/*-------------------------------------------------------------------------
* 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
*
@ -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;

View File

@ -48,8 +48,6 @@ H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
hsize_t size);
H5_DLL haddr_t H5MF_realloc(H5F_t *f, H5FD_mem_t type, hid_t dxpl_id, haddr_t old_addr,
hsize_t old_size, hsize_t new_size);
H5_DLL herr_t H5MF_reserve(H5F_t *f, hsize_t size);
H5_DLL herr_t H5MF_free_reserved(H5F_t *f, hsize_t size);
H5_DLL hbool_t H5MF_alloc_overflow(H5F_t *f, hsize_t size);
H5_DLL htri_t H5MF_can_extend(H5F_t *f, H5FD_mem_t type, haddr_t addr,
hsize_t size, hsize_t extra_requested);