diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-06-10 14:43:15 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-06-10 14:43:15 (GMT) |
commit | ac4c35cca592fc598c5a064fd8f769bbef69bd75 (patch) | |
tree | 6b23aa1ea8834532ca1de25b3fa469bc3d2a8158 /src/H5Fsplit.c | |
parent | 27edf86f6ab408352b4b975669d0759aa47bff78 (diff) | |
download | hdf5-ac4c35cca592fc598c5a064fd8f769bbef69bd75.zip hdf5-ac4c35cca592fc598c5a064fd8f769bbef69bd75.tar.gz hdf5-ac4c35cca592fc598c5a064fd8f769bbef69bd75.tar.bz2 |
[svn-r418] ./html/Files.html
./src/H5F.c
./src/HFcore.c
./src/H5Ffamily.c
./src/H5Flow.c
./src/H5Fmpio.c
./src/H5Fprivate.h
./src/H5Fsec2.c
./src/H5Fsplit.c
./src/H5Fstdio.c
./src/H5MF.c
./src/H5P.c
./src/H5Ppublic.h
Added H5Pset_alignment() so that it is now possible to align
file allocation requests on application-specified
boundaries. Any request >= the specified threshold will begin
on an address which is a multiple of the specified
alignment. Defaults are one for threshold and alignment. The
alignment is done on relative addresses, so the size of the
user block can affect the location of the data in the file.
./src/H5D.c
./src/dsets.c
Added a test for, and fixed the data space caching bug in
datasets. Extending a dataset through one handle will cause
all other handles to the same dataset to get the new dataset
size.
./src/H5S.c
./src/H5Sprivate.h
Removed an unused argument from H5S_read() which duplicated
information from the other argument.
./config/linux
Made `--enable-parallel' the default on my system. It used to
be that way before but then I accidently turned it off and
forgot about it.
./src/H5Fmpio.c
Qualified some function arguments with __unused__. Changed a
couple places where NULL was returned on error for herr_t
functions.
./src/H5P.c
Removed unused autos from H5Pset_mpi().
Diffstat (limited to 'src/H5Fsplit.c')
-rw-r--r-- | src/H5Fsplit.c | 90 |
1 files changed, 81 insertions, 9 deletions
diff --git a/src/H5Fsplit.c b/src/H5Fsplit.c index bc57db3..b875023 100644 --- a/src/H5Fsplit.c +++ b/src/H5Fsplit.c @@ -43,15 +43,19 @@ static herr_t H5F_split_write(H5F_low_t *lf, const H5F_access_t *access_parms, static herr_t H5F_split_flush(H5F_low_t *lf, const H5F_access_t *access_parms); static herr_t H5F_split_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op, hsize_t size, haddr_t *addr/*out*/); - -const H5F_low_class_t H5F_LOW_SPLIT_g[1] = {{ - H5F_split_access, /* access method */ - H5F_split_open, /* open method */ - H5F_split_close, /* close method */ - H5F_split_read, /* read method */ - H5F_split_write, /* write method */ - H5F_split_flush, /* flush method */ - H5F_split_extend, /* extend method */ +static intn H5F_split_alloc (H5F_low_t *lf, intn op, hsize_t alignment, + hsize_t threshold, size_t size, H5MF_free_t *blk, + haddr_t *addr/*out*/); + +const H5F_low_class_t H5F_LOW_SPLIT_g[1] = {{ + H5F_split_access, /*access method */ + H5F_split_open, /*open method */ + H5F_split_close, /*close method */ + H5F_split_read, /*read method */ + H5F_split_write, /*write method */ + H5F_split_flush, /*flush method */ + H5F_split_extend, /*extend method */ + H5F_split_alloc, /*alloc method */ }}; /* @@ -451,3 +455,71 @@ H5F_split_extend(H5F_low_t *lf, const H5F_access_t *access_parms, intn op, FUNC_LEAVE(SUCCEED); } + + +/*------------------------------------------------------------------------- + * Function: H5F_split_alloc + * + * Purpose: Determines if free block BLK in file LF can be used to + * satisfy the request for SIZE bytes. This function is + * actually the same as H5F_low_alloc() except it returns + * failure if the OP is not compatible with the block address, + * insuring that meta data is allocated from one half of the + * address space and raw data from the other half. + * + * Return: Success: Positive if the free block satisfies the + * request exactly, zero if the free block + * over-satisfies the request. The ADDR will + * contain the address within the free block + * where the request starts. + * + * Failure: FAIL + * + * Programmer: Robb Matzke + * Tuesday, June 9, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static intn +H5F_split_alloc (H5F_low_t *lf, intn op, hsize_t alignment, hsize_t threshold, + size_t size, H5MF_free_t *blk, haddr_t *addr/*out*/) +{ + intn ret_value = FAIL; + hsize_t wasted; + + FUNC_ENTER (H5F_split_alloc, FAIL); + assert (lf); + assert (alignment>0); + assert (size>0); + assert (blk); + assert (addr); + + switch (op) { + case H5MF_META: + if (blk->addr.offset & lf->u.split.mask) return FAIL; + break; + case H5MF_RAW: + if (0==(blk->addr.offset & lf->u.split.mask)) return FAIL; + break; + } + + if (size>=threshold) { + wasted = blk->addr.offset % alignment; + } else { + wasted = 0; + } + if (0==wasted && size==blk->size) { + /* exact match */ + *addr = blk->addr; + ret_value = 1; + } else if (blk->size>wasted && blk->size-wasted>=size) { + /* over-satisfied */ + *addr = blk->addr; + H5F_addr_inc (addr, wasted); + ret_value = 0; + } + + FUNC_LEAVE (ret_value); +} |