From 0ee053bb95a620b6f8109d22a372f6acc1cee300 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 3 Oct 2015 22:58:55 -0500 Subject: [svn-r27944] Description: Avoid duplicating source FAPL & DAPL if they are already available. Tested on: MacOSX/64 10.10.5 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5Dvirtual.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index af9963d..cbd9e35 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -615,12 +615,16 @@ H5D__virtual_reset_layout(H5O_layout_t *layout) (void)HDmemset(layout->storage.u.virt.min_dims, 0, sizeof(layout->storage.u.virt.min_dims)); /* Close access property lists */ - if(layout->storage.u.virt.source_fapl >= 0) + if(layout->storage.u.virt.source_fapl >= 0) { if(H5I_dec_ref(layout->storage.u.virt.source_fapl) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source fapl") - if(layout->storage.u.virt.source_dapl >= 0) + layout->storage.u.virt.source_fapl = -1; + } /* end if */ + if(layout->storage.u.virt.source_dapl >= 0) { if(H5I_dec_ref(layout->storage.u.virt.source_dapl) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source dapl") + layout->storage.u.virt.source_dapl = -1; + } /* end if */ /* The list is no longer initialized */ layout->storage.u.virt.init = FALSE; @@ -2013,12 +2017,14 @@ H5D__virtual_init(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, const H5D_t *dset, storage->printf_gap = (hsize_t)0; /* Retrieve VDS file FAPL to layout */ - if((storage->source_fapl = H5F_get_access_plist(f, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fapl") + if(storage->source_fapl <= 0) + if((storage->source_fapl = H5F_get_access_plist(f, FALSE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fapl") /* Copy DAPL to layout */ - if((storage->source_dapl = H5P_copy_plist(dapl, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dapl") + if(storage->source_dapl <= 0) + if((storage->source_dapl = H5P_copy_plist(dapl, FALSE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dapl") /* Mark layout as not fully initialized (must be done prior to I/O for * unlimited/printf selections) */ -- cgit v0.12