From 59fbb04095a4aa0019fc8623bad9d5bf72b5ddec Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 9 Jul 2005 00:02:14 -0500 Subject: [svn-r11058] Purpose: Bug fix Description: Correct error where the dataset sieve buffer was inadvertantly disabled, resulting in poor raw data I/O performance for certain I/O patterns. Solution: Hook dataset sieve buffer size setting back up. Platforms tested: FreeBSD 4.11 (sleipnir) Solaris 2.9 (shanti) --- src/H5D.c | 21 +++++++++++++++++++-- src/H5F.c | 33 +++++++++++++++++++++++++++++++++ src/H5Fprivate.h | 4 ++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index c2874e5..e1598fe 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1580,7 +1580,7 @@ H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type) H5D_shared_t *new_dset = NULL; /* New dataset object */ H5D_shared_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5D_new, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5D_new) if (NULL==(new_dset = H5FL_MALLOC(H5D_shared_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -2176,6 +2176,9 @@ H5D_create(H5G_entry_t *loc, const char *name, hid_t type_id, const H5S_t *space tmp_size = H5S_GET_EXTENT_NPOINTS(new_dset->shared->space) * H5T_get_size(new_dset->shared->type); H5_ASSIGN_OVERFLOW(new_dset->shared->layout.u.contig.size,tmp_size,hssize_t,hsize_t); + + /* Get the sieve buffer size for this dataset */ + new_dset->shared->cache.contig.sieve_buf_size = H5F_SIEVE_BUF_SIZE(loc->file); } /* end case */ break; @@ -2556,6 +2559,9 @@ H5D_open_oid(const H5G_entry_t *ent, hid_t dxpl_id) /* Set the I/O functions for this layout type */ dataset->shared->io_ops.readvv=H5D_contig_readvv; dataset->shared->io_ops.writevv=H5D_contig_writevv; + + /* Get the sieve buffer size for this dataset */ + dataset->shared->cache.contig.sieve_buf_size = H5F_SIEVE_BUF_SIZE(ent->file); break; case H5D_CHUNKED: @@ -2767,7 +2773,18 @@ H5D_close(H5D_t *dataset) /* Free the data sieve buffer, if it's been allocated */ if(dataset->shared->cache.contig.sieve_buf) { assert(dataset->shared->layout.type!=H5D_COMPACT); /* We should never have a sieve buffer for compact storage */ - assert(dataset->shared->cache.contig.sieve_dirty==0); /* The buffer had better be flushed... */ + + /* Flush the raw data buffer, if its dirty */ + if (dataset->shared->cache.contig.sieve_dirty) { + /* Write dirty data sieve buffer to file */ + if (H5F_block_write(dataset->ent.file, H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc, + dataset->shared->cache.contig.sieve_size, H5AC_dxpl_id, dataset->shared->cache.contig.sieve_buf) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") + + /* Reset sieve buffer dirty flag */ + dataset->shared->cache.contig.sieve_dirty=0; + } /* end if */ + dataset->shared->cache.contig.sieve_buf = H5FL_BLK_FREE (sieve_buf,dataset->shared->cache.contig.sieve_buf); } /* end if */ diff --git a/src/H5F.c b/src/H5F.c index ca7f5c7..dd940c8 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -3235,6 +3235,39 @@ H5F_grp_btree_shared(const H5F_t *f) /*------------------------------------------------------------------------- + * Function: H5F_sieve_buf_size + * + * Purpose: Replaced a macro to retrieve the dataset sieve buffer size + * now that the generic properties are being used to store + * the values. + * + * Return: Success: Non-void, and the dataset sieve buffer size + * is returned. + * + * Failure: void (should not happen) + * + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * Jul 8 2005 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +size_t +H5F_sieve_buf_size(const H5F_t *f) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOFUNC here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_sieve_buf_size) + + assert(f); + assert(f->shared); + + FUNC_LEAVE_NOAPI(f->shared->sieve_buf_size) +} /* end H5F_sieve_buf_size() */ + + +/*------------------------------------------------------------------------- * Function: H5F_block_read * * Purpose: Reads some data from a file/server/etc into a buffer. diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 5c1909f..ba978a8 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -214,6 +214,8 @@ typedef struct H5F_t H5F_t; #define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared) /* Base address of file */ #define H5F_BASE_ADDR(F) ((F)->shared->base_addr) +/* Sieve buffer size for datasets */ +#define H5F_SIEVE_BUF_SIZE(F) ((F)->shared->sieve_buf_size) #else /* H5F_PACKAGE */ #define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F)) #define H5F_SIZEOF_SIZE(F) (H5F_sizeof_size(F)) @@ -225,6 +227,7 @@ typedef struct H5F_t H5F_t; #define H5F_HAS_FEATURE(F,FL) (H5F_has_feature(F,FL)) #define H5F_GRP_BTREE_SHARED(F) (H5F_grp_btree_shared(F)) #define H5F_BASE_ADDR(F) (H5F_get_base_addr(F)) +#define H5F_SIEVE_BUF_SIZE(F) (H5F_sieve_buf_size(F)) #endif /* H5F_PACKAGE */ @@ -438,6 +441,7 @@ H5_DLL size_t H5F_rdcc_nbytes(const H5F_t *f); H5_DLL size_t H5F_rdcc_nelmts(const H5F_t *f); H5_DLL double H5F_rdcc_w0(const H5F_t *f); H5_DLL struct H5RC_t *H5F_grp_btree_shared(const H5F_t *f); +H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f); /* Functions that operate on blocks of bytes wrt super block */ H5_DLL herr_t H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, -- cgit v0.12