hdf5/src/H5HLpkg.h
John Mainzer c100b0bf26 [svn-r11470] Purpose:
Repair synchronization bug in the metadata cache in PHDF5

Also repair numerous other bugs that surfaced in testing the
bug fix.


Description:

While operations modifying metadata must be collective, we allow
independant reads.  This allows metadata caches on different processes
to adjust to different sizes, and to place the entries on their dirty
lists in different orders.  Since only process 0 actually writes
metadata to disk (all other processes thought they did, but the writes
were discarded on the theory that they had to be collective), this made
it possible for another process to modify metadata, flush it, and then
read it back in in its original form (pre-modification) form.  The
possibilities for file corruption should be obvious.


Solution:

Make the policy that only process 0 can write to file explicit, and
visible to the metadata caches.  Thus only process 0 may flush dirty
entries -- all other caches must retain dirty entries until they are
informed by process 0 that the entries are clean.

Synchronization is handled by counting the bytes of dirty cache entries
created, and then synching up between the caches whenever the sum
exceeds an (eventually user specified) limit.  Dirty metadata creation
is consistent across all processes because all operations modifying
metadata must be collective.

This change uncovered may bugs which are repaired in this checkin.
It also required modification of H5HL and H5O to allocate file space
on insertion rather than on flush from cache.


Platforms tested:

H5committest, heping(parallel & serial)

Misc. update:
2005-09-27 00:20:11 -05:00

81 lines
3.0 KiB
C

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the files COPYING and Copyright.html. COPYING can be found at the root *
* of the source code distribution tree; Copyright.html can be found at the *
* root level of an installed copy of the electronic HDF5 document set and *
* is linked from the top-level documents page. It can also be found at *
* http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
* access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
* Wednesday, July 9, 2003
*
* Purpose: This file contains declarations which are visible
* only within the H5HL package. Source files outside the
* H5HL package should include H5HLprivate.h instead.
*/
#ifndef H5HL_PACKAGE
#error "Do not include this file outside the H5HL package!"
#endif
#ifndef _H5HLpkg_H
#define _H5HLpkg_H
/* Get package's private header */
#include "H5HLprivate.h"
/* Other private headers needed by this file */
/*****************************/
/* Package Private Variables */
/*****************************/
/* The cache subclass */
H5_DLLVAR const H5AC_class_t H5AC_LHEAP[1];
/**************************/
/* Package Private Macros */
/**************************/
#define H5HL_SIZEOF_HDR(F) \
H5HL_ALIGN(H5HL_SIZEOF_MAGIC + /*heap signature */ \
4 + /*reserved */ \
H5F_SIZEOF_SIZE (F) + /*data size */ \
H5F_SIZEOF_SIZE (F) + /*free list head */ \
H5F_SIZEOF_ADDR (F)) /*data address */
/****************************/
/* Package Private Typedefs */
/****************************/
typedef struct H5HL_free_t {
size_t offset; /*offset of free block */
size_t size; /*size of free block */
struct H5HL_free_t *prev; /*previous entry in free list */
struct H5HL_free_t *next; /*next entry in free list */
} H5HL_free_t;
struct H5HL_t {
H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */
/* first field in structure */
haddr_t addr; /*address of data */
size_t disk_alloc; /*data bytes allocated on disk */
size_t mem_alloc; /*data bytes allocated in mem */
uint8_t *chunk; /*the chunk, including header */
H5HL_free_t *freelist; /*the free list */
};
/******************************/
/* Package Private Prototypes */
/******************************/
#endif