diff options
author | Robb Matzke <matzke@llnl.gov> | 1997-08-29 19:05:50 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1997-08-29 19:05:50 (GMT) |
commit | c48f8b7590ed6bc334a6d62ab651cda8124ba90f (patch) | |
tree | b782b9397109c8307122692a5da4656a79b76dbe | |
parent | 3d526ab6cb594c656497fce7efe0589c0f840272 (diff) | |
download | hdf5-c48f8b7590ed6bc334a6d62ab651cda8124ba90f.zip hdf5-c48f8b7590ed6bc334a6d62ab651cda8124ba90f.tar.gz hdf5-c48f8b7590ed6bc334a6d62ab651cda8124ba90f.tar.bz2 |
[svn-r52] ./src/H5O.c
If the symbol table entry doesn't change then the ent_modified
argument to H5O_modify() doesn't change. This allows us to
set ent_modified to false and then call H5O_modify() a whole
bunch of times and easily determine if any of the calls
modified the symbol table entry.
./src/H5D.c
Fixed caching of things in the symbol table entry using the
scheme we came up with a couple months ago.
-rw-r--r-- | src/H5D.c | 65 | ||||
-rw-r--r-- | src/H5O.c | 5 |
2 files changed, 46 insertions, 24 deletions
@@ -300,19 +300,17 @@ herr_t H5D_flush(hatom_t oid) /* * Write the necessary messages to the header. */ - /* - * Quincey? It should be just a matter of filling in the - * appropriate H5O_*_t struct and passing it to - * H5O_modify() along with &d_sym. - */ +/*------------------------------------------------------------------------- + * Quincey? It should be just a matter of filling in the + * appropriate H5O_*_t struct and passing it to + * H5O_modify() along with &d_sym. + *------------------------------------------------------------------------- + */ /* * Give the object header a name so others can access it. */ -#if 1 /* SEE_BELOW */ - d_sym.type = H5G_NOTHING_CACHED; -#endif if (H5G_insert (file, file->root_sym, NULL, dataset->name, &d_sym)<0) { HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); /*can't name header*/ @@ -324,22 +322,45 @@ herr_t H5D_flush(hatom_t oid) * Update existing header messages if necessary. If updating the * header messages changes the symbol table entry because new * info is cached, then we must re-insert the symbol entry into - * the directory. I'm still working on caching things in symbol - * table entries, so the easiest thing to do is: - * - * A. Don't change any messages, or - * B. Don't let the message cache anything, or - * C. Uncomment the `SEE_BELOW' statement above. + * the directory. + */ + hbool_t entry_changed = FALSE; + +/*------------------------------------------------------------------------- + * Quincey, you can get rid of this statement if either of the + * following are true: You don't change any messages or the + * changed messages aren't cached in the symbol table entry. + *------------------------------------------------------------------------- + */ + if (H5G_find (file, file->root_sym, NULL, dataset->name, &d_sym)<0) { + HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL); + } + + /* + * Change any messaages that need to be updated. */ - - /* - * Quincey? It should be just a matter of filling in the - * appropriate H5O_*_t structs and passing them to - * H5O_modify(). Don't worry about caching things in - * the symbol table entry yet (pass NULL for the - * symbol table entry). - */ +#if 0 + H5O_modify (file, d_sym.header, &d_sym, &entry_changed, + H5O_WHATEVER, 0, &the_message); + H5O_modify (file, d_sym.header, &d_sym, &entry_changed, + H5O_WHATEVER, 0, &the_message); + H5O_modify (file, d_sym.header, &d_sym, &entry_changed, + H5O_WHATEVER, 0, &the_message); +#endif + +/*------------------------------------------------------------------------- + * Quincey, you can get rid of this `if' statement and the + * H5G_modify() call subject to the same constraints as above. + *------------------------------------------------------------------------- + */ + if (entry_changed) { + /* + * Make sure the symbol table entry as modified by the + * changing of messages gets back to the file. + */ + H5G_modify (file, file->root_sym, NULL, dataset->name, &d_sym); + } } dataset->modified = FALSE; } @@ -686,7 +686,8 @@ H5O_peek (hdf5_file_t *f, haddr_t addr, const H5O_class_t *type, * optional symbol table entry ENT can be supplied in which * case the cache fields in that symbol table are updated if * appropriate. If the symbol table entry changes then the - * optional ENT_MODIFIED arg will point to a non-zero value. + * optional ENT_MODIFIED arg will point to a non-zero value, + * otherwise ENT_MODIFIED isn't changed. * * The OVERWRITE argument is either a sequence number of a * message to overwrite (usually zero) or the constant @@ -759,7 +760,7 @@ H5O_modify (hdf5_file_t *f, haddr_t addr, H5G_entry_t *ent, /* Copy into the symbol table entry */ if (oh->nlink<=1 && ent && type->cache) { hbool_t modified = (type->cache)(ent, mesg); - if (ent_modified) *ent_modified = modified; + if (modified && ent_modified) *ent_modified = modified; } FUNC_LEAVE (sequence); |