-
-
Notifications
You must be signed in to change notification settings - Fork 266
/
H5Dio.c
1510 lines (1281 loc) · 69.8 KB
/
H5Dio.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* 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 LICENSE file, which can be found at the root of the source code *
* distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* [email protected]. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/****************/
/* Module Setup */
/****************/
#include "H5Dmodule.h" /* This source code file is part of the H5D module */
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Dpkg.h" /* Dataset functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
#include "H5MMprivate.h" /* Memory management */
#include "H5Sprivate.h" /* Dataspace */
/****************/
/* Local Macros */
/****************/
/******************/
/* Local Typedefs */
/******************/
/********************/
/* Local Prototypes */
/********************/
/* Setup/teardown routines */
static herr_t H5D__ioinfo_init(size_t count, H5D_io_op_type_t op_type, H5D_dset_io_info_t *dset_info,
H5D_io_info_t *io_info);
static herr_t H5D__dset_ioinfo_init(H5D_t *dset, H5D_dset_io_info_t *dset_info, H5D_storage_t *store);
static herr_t H5D__typeinfo_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info,
const H5T_t *mem_type);
static herr_t H5D__typeinfo_init_phase2(H5D_io_info_t *io_info);
static herr_t H5D__typeinfo_init_phase3(H5D_io_info_t *io_info);
#ifdef H5_HAVE_PARALLEL
static herr_t H5D__ioinfo_adjust(H5D_io_info_t *io_info);
#endif /* H5_HAVE_PARALLEL */
static herr_t H5D__typeinfo_term(H5D_io_info_t *io_info);
/*********************/
/* Package Variables */
/*********************/
/*******************/
/* Local Variables */
/*******************/
/* Declare a free list to manage blocks of type conversion data */
H5FL_BLK_DEFINE(type_conv);
/*-------------------------------------------------------------------------
* Function: H5D__read
*
* Purpose: Reads multiple (parts of) DATASETs into application memory BUFs.
* See H5Dread_multi() for complete details.
*
* Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t
H5D__read(size_t count, H5D_dset_io_info_t *dset_info)
{
H5D_io_info_t io_info; /* Dataset I/O info for multi dsets */
H5S_t *orig_mem_space_local; /* Local buffer for orig_mem_space */
H5S_t **orig_mem_space = NULL; /* If not NULL, ptr to an array of dataspaces */
/* containing the original memory spaces contained */
/* in dset_info. This is needed in order to */
/* restore the original state of dset_info if we */
/* replaced any mem spaces with equivalents */
/* projected to a rank equal to that of file_space. */
/* */
/* This field is only used if */
/* H5S_select_shape_same() returns true when */
/* comparing at least one mem_space and data_space, */
/* and the mem_space has a different rank. */
/* */
/* Note that this is a temporary variable - the */
/* projected memory space is stored in dset_info, */
/* and will be freed when that structure is */
/* freed. */
H5D_storage_t store_local; /* Local buffer for store */
H5D_storage_t *store = &store_local; /* Union of EFL and chunk pointer in file space */
size_t io_op_init = 0; /* Number I/O ops that have been initialized */
size_t io_skipped =
0; /* Number I/O ops that have been skipped (due to the dataset not being allocated) */
size_t i; /* Local index variable */
char fake_char; /* Temporary variable for NULL buffer pointers */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
#ifdef H5_HAVE_PARALLEL
/* Reset the actual io mode properties to the default values in case
* the DXPL (if it's non-default) was previously used in a collective
* I/O operation.
*/
if (!H5CX_is_def_dxpl()) {
H5CX_set_mpio_actual_chunk_opt(H5D_MPIO_NO_CHUNK_OPTIMIZATION);
H5CX_set_mpio_actual_io_mode(H5D_MPIO_NO_COLLECTIVE);
} /* end if */
#endif
/* Init io_info */
if (H5D__ioinfo_init(count, H5D_IO_OP_READ, dset_info, &io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info");
/* Allocate store buffer if necessary */
if (count > 1)
if (NULL == (store = (H5D_storage_t *)H5MM_malloc(count * sizeof(H5D_storage_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate dset storage info array buffer");
#ifdef H5_HAVE_PARALLEL
/* Check for non-MPI-based VFD. Only need to check first dataset since all
* share the same file. */
if (!(H5F_HAS_FEATURE(dset_info[0].dset->oloc.file, H5FD_FEAT_HAS_MPI))) {
H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
/* Get I/O transfer mode */
if (H5CX_get_io_xfer_mode(&io_xfer_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode");
/* Collective access is not permissible without a MPI based VFD */
if (io_xfer_mode == H5FD_MPIO_COLLECTIVE)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only");
} /* end if */
#endif /*H5_HAVE_PARALLEL*/
/* Iterate over all dsets and construct I/O information necessary to do I/O */
for (i = 0; i < count; i++) {
haddr_t prev_tag = HADDR_UNDEF;
/* Check args */
if (NULL == dset_info[i].dset)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
if (NULL == dset_info[i].dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file");
/* Set metadata tagging with dset oheader addr */
H5AC_tag(dset_info[i].dset->oloc.addr, &prev_tag);
/* Set up datatype info for operation */
if (H5D__typeinfo_init(&io_info, &(dset_info[i]), dset_info[i].mem_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info");
/* Make certain that the number of elements in each selection is the same, and cache nelmts in
* dset_info */
dset_info[i].nelmts = H5S_GET_SELECT_NPOINTS(dset_info[i].mem_space);
if (dset_info[i].nelmts != H5S_GET_SELECT_NPOINTS(dset_info[i].file_space))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"src and dest dataspaces have different number of elements selected");
/* Check for a NULL buffer */
if (NULL == dset_info[i].buf.vp) {
/* Check for any elements selected (which is invalid) */
if (dset_info[i].nelmts > 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer");
/* If the buffer is nil, and 0 element is selected, make a fake buffer. */
dset_info[i].buf.vp = &fake_char;
} /* end if */
/* Make sure that both selections have their extents set */
if (!(H5S_has_extent(dset_info[i].file_space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set");
if (!(H5S_has_extent(dset_info[i].mem_space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set");
/* H5S_select_shape_same() has been modified to accept topologically identical
* selections with different rank as having the same shape (if the most
* rapidly changing coordinates match up), but the I/O code still has
* difficulties with the notion.
*
* To solve this, check if H5S_select_shape_same() returns true
* and the ranks of the mem and file spaces are different. If so,
* construct a new mem space that is equivalent to the old mem space, and
* use that instead.
*
* Note that in general, this requires us to touch up the memory buffer as
* well.
*/
if (dset_info[i].nelmts > 0 &&
true == H5S_SELECT_SHAPE_SAME(dset_info[i].mem_space, dset_info[i].file_space) &&
H5S_GET_EXTENT_NDIMS(dset_info[i].mem_space) != H5S_GET_EXTENT_NDIMS(dset_info[i].file_space)) {
ptrdiff_t buf_adj = 0;
/* Allocate original memory space buffer if necessary */
if (!orig_mem_space) {
if (count > 1) {
/* Allocate buffer */
if (NULL == (orig_mem_space = (H5S_t **)H5MM_calloc(count * sizeof(H5S_t *))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
"couldn't allocate original memory space array buffer");
}
else
/* Use local buffer */
orig_mem_space = &orig_mem_space_local;
}
/* Save original memory space */
orig_mem_space[i] = dset_info[i].mem_space;
dset_info[i].mem_space = NULL;
/* Attempt to construct projected dataspace for memory dataspace */
if (H5S_select_construct_projection(orig_mem_space[i], &dset_info[i].mem_space,
(unsigned)H5S_GET_EXTENT_NDIMS(dset_info[i].file_space),
(hsize_t)dset_info[i].type_info.dst_type_size, &buf_adj) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to construct projected memory dataspace");
assert(dset_info[i].mem_space);
/* Adjust the buffer by the given amount */
dset_info[i].buf.vp = (void *)(((uint8_t *)dset_info[i].buf.vp) + buf_adj);
} /* end if */
/* Set up I/O operation */
if (H5D__dset_ioinfo_init(dset_info[i].dset, &(dset_info[i]), &(store[i])) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up I/O operation");
/* Check if any filters are applied to the dataset */
if (dset_info[i].dset->shared->dcpl_cache.pline.nused > 0)
io_info.filtered_count++;
/* If space hasn't been allocated and not using external storage,
* return fill value to buffer if fill time is upon allocation, or
* do nothing if fill time is never. If the dataset is compact and
* fill time is NEVER, there is no way to tell whether part of data
* has been overwritten. So just proceed in reading.
*/
if (dset_info[i].nelmts > 0 && dset_info[i].dset->shared->dcpl_cache.efl.nused == 0 &&
!(*dset_info[i].dset->shared->layout.ops->is_space_alloc)(
&dset_info[i].dset->shared->layout.storage) &&
!(dset_info[i].dset->shared->layout.ops->is_data_cached &&
(*dset_info[i].dset->shared->layout.ops->is_data_cached)(dset_info[i].dset->shared))) {
H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */
/* Retrieve dataset's fill-value properties */
if (H5P_is_fill_value_defined(&dset_info[i].dset->shared->dcpl_cache.fill, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined");
/* Should be impossible, but check anyway... */
if (fill_status == H5D_FILL_VALUE_UNDEFINED &&
(dset_info[i].dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC ||
dset_info[i].dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET))
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL,
"read failed: dataset doesn't exist, no data can be read");
/* If we're never going to fill this dataset, just leave the junk in the user's buffer */
if (dset_info[i].dset->shared->dcpl_cache.fill.fill_time != H5D_FILL_TIME_NEVER)
/* Go fill the user's selection with the dataset's fill value */
if (H5D__fill(dset_info[i].dset->shared->dcpl_cache.fill.buf, dset_info[i].dset->shared->type,
dset_info[i].buf.vp, dset_info[i].type_info.mem_type,
dset_info[i].mem_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed");
/* No need to perform any more I/O for this dataset */
dset_info[i].skip_io = true;
io_skipped = io_skipped + 1;
} /* end if */
else {
/* Sanity check that space is allocated, if there are elements */
if (dset_info[i].nelmts > 0)
assert(
(*dset_info[i].dset->shared->layout.ops->is_space_alloc)(
&dset_info[i].dset->shared->layout.storage) ||
(dset_info[i].dset->shared->layout.ops->is_data_cached &&
(*dset_info[i].dset->shared->layout.ops->is_data_cached)(dset_info[i].dset->shared)) ||
dset_info[i].dset->shared->dcpl_cache.efl.nused > 0 ||
dset_info[i].dset->shared->layout.type == H5D_COMPACT);
dset_info[i].skip_io = false;
}
/* Call storage method's I/O initialization routine */
if (dset_info[i].layout_ops.io_init &&
(dset_info[i].layout_ops.io_init)(&io_info, &(dset_info[i])) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info");
io_op_init++;
/* Reset metadata tagging */
H5AC_tag(prev_tag, NULL);
} /* end of for loop */
assert(io_op_init == count);
/* If no datasets have I/O, we're done */
if (io_skipped == count)
HGOTO_DONE(SUCCEED);
/* Perform second phase of type info initialization */
if (H5D__typeinfo_init_phase2(&io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info (second phase)");
#ifdef H5_HAVE_PARALLEL
/* Adjust I/O info for any parallel or selection I/O */
if (H5D__ioinfo_adjust(&io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to adjust I/O info for parallel or selection I/O");
#endif /* H5_HAVE_PARALLEL */
/* Perform third phase of type info initialization */
if (H5D__typeinfo_init_phase3(&io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info (third phase)");
H5CX_set_no_selection_io_cause(io_info.no_selection_io_cause);
/* If multi dataset I/O callback is not provided, perform read IO via
* single-dset path with looping */
if (io_info.md_io_ops.multi_read_md) {
/* Create sel_pieces array if any pieces are selected */
if (io_info.piece_count > 0) {
assert(!io_info.sel_pieces);
assert(io_info.pieces_added == 0);
/* Allocate sel_pieces array */
if (NULL ==
(io_info.sel_pieces = H5MM_malloc(io_info.piece_count * sizeof(io_info.sel_pieces[0]))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate array of selected pieces");
}
/* MDIO-specific second phase initialization */
for (i = 0; i < count; i++) {
/* Check for skipped I/O */
if (dset_info[i].skip_io)
continue;
if (dset_info[i].layout_ops.mdio_init) {
haddr_t prev_tag = HADDR_UNDEF;
/* Set metadata tagging with dset oheader addr */
H5AC_tag(dset_info[i].dset->oloc.addr, &prev_tag);
/* Make second phase IO init call */
if ((dset_info[i].layout_ops.mdio_init)(&io_info, &(dset_info[i])) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't populate array of selected pieces");
/* Reset metadata tagging */
H5AC_tag(prev_tag, NULL);
}
}
/* Invoke correct "high level" I/O routine */
if ((*io_info.md_io_ops.multi_read_md)(&io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data");
} /* end if */
else {
haddr_t prev_tag = HADDR_UNDEF;
/* Allocate selection I/O parameter arrays if necessary */
if (!H5D_LAYOUT_CB_PERFORM_IO(&io_info) && io_info.piece_count > 0) {
if (NULL == (io_info.mem_spaces = H5MM_malloc(io_info.piece_count * sizeof(H5S_t *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"memory allocation failed for memory space list");
if (NULL == (io_info.file_spaces = H5MM_malloc(io_info.piece_count * sizeof(H5S_t *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"memory allocation failed for file space list");
if (NULL == (io_info.addrs = H5MM_malloc(io_info.piece_count * sizeof(haddr_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"memory allocation failed for piece address list");
if (NULL == (io_info.element_sizes = H5MM_malloc(io_info.piece_count * sizeof(size_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"memory allocation failed for element size list");
if (NULL == (io_info.rbufs = H5MM_malloc(io_info.piece_count * sizeof(void *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"memory allocation failed for read buffer list");
if (io_info.max_tconv_type_size > 0)
if (NULL ==
(io_info.sel_pieces = H5MM_malloc(io_info.piece_count * sizeof(io_info.sel_pieces[0]))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"unable to allocate array of selected pieces");
}
/* Loop with serial & single-dset read IO path */
for (i = 0; i < count; i++) {
/* Check for skipped I/O */
if (dset_info[i].skip_io)
continue;
/* Set metadata tagging with dset object header addr */
H5AC_tag(dset_info[i].dset->oloc.addr, &prev_tag);
/* Invoke correct "high level" I/O routine */
if ((*dset_info[i].io_ops.multi_read)(&io_info, &dset_info[i]) < 0) {
/* Reset metadata tagging */
H5AC_tag(prev_tag, NULL);
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data");
}
/* Reset metadata tagging */
H5AC_tag(prev_tag, NULL);
}
/* Make final selection I/O call if the multi_read callbacks did not perform the actual I/O
* (if using selection I/O and either multi dataset or type conversion) */
if (!H5D_LAYOUT_CB_PERFORM_IO(&io_info)) {
/* Check for type conversion */
if (io_info.max_tconv_type_size > 0) {
/* Type conversion pathway */
if (H5D__scatgath_read_select(&io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "type conversion selection read failed");
}
else {
/* Call selection I/O directly */
H5_CHECK_OVERFLOW(io_info.pieces_added, size_t, uint32_t);
if (H5F_shared_select_read(io_info.f_sh, H5FD_MEM_DRAW, (uint32_t)io_info.pieces_added,
io_info.mem_spaces, io_info.file_spaces, io_info.addrs,
io_info.element_sizes, io_info.rbufs) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "selection read failed");
}
}
#ifdef H5_HAVE_PARALLEL
/* Report the actual I/O mode to the application if appropriate */
if (io_info.using_mpi_vfd) {
H5FD_mpio_xfer_t xfer_mode; /* Parallel transfer for this request */
/* Get the parallel I/O transfer mode */
if (H5CX_get_io_xfer_mode(&xfer_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode");
/* Only report the collective I/O mode if we're actually performing collective I/O */
if (xfer_mode == H5FD_MPIO_COLLECTIVE) {
H5CX_set_mpio_actual_io_mode(io_info.actual_io_mode);
/* If we did selection I/O, report that we used "link chunk" mode, since that's the most
* analogous to what selection I/O does */
if (io_info.use_select_io == H5D_SELECTION_IO_MODE_ON)
H5CX_set_mpio_actual_chunk_opt(H5D_MPIO_LINK_CHUNK);
}
}
#endif /* H5_HAVE_PARALLEL */
}
done:
/* Shut down the I/O op information */
for (i = 0; i < io_op_init; i++)
if (dset_info[i].layout_ops.io_term &&
(*dset_info[i].layout_ops.io_term)(&io_info, &(dset_info[i])) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info");
/* Shut down datatype info for operation */
if (H5D__typeinfo_term(&io_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info");
/* Discard projected mem spaces and restore originals */
if (orig_mem_space) {
for (i = 0; i < count; i++)
if (orig_mem_space[i]) {
if (H5S_close(dset_info[i].mem_space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL,
"unable to shut down projected memory dataspace");
dset_info[i].mem_space = orig_mem_space[i];
}
/* Free orig_mem_space array if it was allocated */
if (orig_mem_space != &orig_mem_space_local)
H5MM_free(orig_mem_space);
}
/* Free global piece array */
H5MM_xfree(io_info.sel_pieces);
/* Free selection I/O arrays */
H5MM_xfree(io_info.mem_spaces);
H5MM_xfree(io_info.file_spaces);
H5MM_xfree(io_info.addrs);
H5MM_xfree(io_info.element_sizes);
H5MM_xfree(io_info.rbufs);
/* Free store array if it was allocated */
if (store != &store_local)
H5MM_free(store);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__read() */
/*-------------------------------------------------------------------------
* Function: H5D__write
*
* Purpose: Writes multiple (part of) DATASETs to a file from application
* memory BUFs. See H5Dwrite_multi() for complete details.
*
* This was referred from H5D__write for multi-dset work.
*
* Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
herr_t
H5D__write(size_t count, H5D_dset_io_info_t *dset_info)
{
H5D_io_info_t io_info; /* Dataset I/O info for multi dsets */
H5S_t *orig_mem_space_local; /* Local buffer for orig_mem_space */
H5S_t **orig_mem_space = NULL; /* If not NULL, ptr to an array of dataspaces */
/* containing the original memory spaces contained */
/* in dset_info. This is needed in order to */
/* restore the original state of dset_info if we */
/* replaced any mem spaces with equivalents */
/* projected to a rank equal to that of file_space. */
/* */
/* This field is only used if */
/* H5S_select_shape_same() returns true when */
/* comparing at least one mem_space and data_space, */
/* and the mem_space has a different rank. */
/* */
/* Note that this is a temporary variable - the */
/* projected memory space is stored in dset_info, */
/* and will be freed when that structure is */
/* freed. */
H5D_storage_t store_local; /* Local buffer for store */
H5D_storage_t *store = &store_local; /* Union of EFL and chunk pointer in file space */
size_t io_op_init = 0; /* Number I/O ops that have been initialized */
size_t i; /* Local index variable */
char fake_char; /* Temporary variable for NULL buffer pointers */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
#ifdef H5_HAVE_PARALLEL
/* Reset the actual io mode properties to the default values in case
* the DXPL (if it's non-default) was previously used in a collective
* I/O operation.
*/
if (!H5CX_is_def_dxpl()) {
H5CX_set_mpio_actual_chunk_opt(H5D_MPIO_NO_CHUNK_OPTIMIZATION);
H5CX_set_mpio_actual_io_mode(H5D_MPIO_NO_COLLECTIVE);
} /* end if */
#endif
/* Init io_info */
if (H5D__ioinfo_init(count, H5D_IO_OP_WRITE, dset_info, &io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info");
/* Allocate store buffer if necessary */
if (count > 1)
if (NULL == (store = (H5D_storage_t *)H5MM_malloc(count * sizeof(H5D_storage_t))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate dset storage info array buffer");
/* Iterate over all dsets and construct I/O information */
for (i = 0; i < count; i++) {
bool should_alloc_space = false; /* Whether or not to initialize dataset's storage */
haddr_t prev_tag = HADDR_UNDEF;
/* Check args */
if (NULL == dset_info[i].dset)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset");
if (NULL == dset_info[i].dset->oloc.file)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file");
/* Set metadata tagging with dset oheader addr */
H5AC_tag(dset_info[i].dset->oloc.addr, &prev_tag);
/* All filters in the DCPL must have encoding enabled. */
if (!dset_info[i].dset->shared->checked_filters) {
if (H5Z_can_apply(dset_info[i].dset->shared->dcpl_id, dset_info[i].dset->shared->type_id) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "can't apply filters");
dset_info[i].dset->shared->checked_filters = true;
} /* end if */
/* Check if we are allowed to write to this file */
if (0 == (H5F_INTENT(dset_info[i].dset->oloc.file) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file");
/* Set up datatype info for operation */
if (H5D__typeinfo_init(&io_info, &(dset_info[i]), dset_info[i].mem_type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info");
/* Various MPI based checks */
#ifdef H5_HAVE_PARALLEL
if (H5F_HAS_FEATURE(dset_info[i].dset->oloc.file, H5FD_FEAT_HAS_MPI)) {
/* If MPI based VFD is used, no VL or region reference datatype support yet. */
/* This is because they use the global heap in the file and we don't */
/* support parallel access of that yet */
if (H5T_is_vl_storage(dset_info[i].type_info.mem_type) > 0)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
"Parallel IO does not support writing VL or region reference datatypes yet");
} /* end if */
else {
H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
/* Get I/O transfer mode */
if (H5CX_get_io_xfer_mode(&io_xfer_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode");
/* Collective access is not permissible without a MPI based VFD */
if (io_xfer_mode == H5FD_MPIO_COLLECTIVE)
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL,
"collective access for MPI-based driver only");
} /* end else */
#endif /*H5_HAVE_PARALLEL*/
/* Make certain that the number of elements in each selection is the same, and cache nelmts in
* dset_info */
dset_info[i].nelmts = H5S_GET_SELECT_NPOINTS(dset_info[i].mem_space);
if (dset_info[i].nelmts != H5S_GET_SELECT_NPOINTS(dset_info[i].file_space))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"src and dest dataspaces have different number of elements selected");
/* Check for a NULL buffer */
if (NULL == dset_info[i].buf.cvp) {
/* Check for any elements selected (which is invalid) */
if (dset_info[i].nelmts > 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no input buffer");
/* If the buffer is nil, and 0 element is selected, make a fake buffer. */
dset_info[i].buf.cvp = &fake_char;
} /* end if */
/* Make sure that both selections have their extents set */
if (!(H5S_has_extent(dset_info[i].file_space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set");
if (!(H5S_has_extent(dset_info[i].mem_space)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set");
/* H5S_select_shape_same() has been modified to accept topologically identical
* selections with different rank as having the same shape (if the most
* rapidly changing coordinates match up), but the I/O code still has
* difficulties with the notion.
*
* To solve this, check if H5S_select_shape_same() returns true
* and the ranks of the mem and file spaces are different. If so,
* construct a new mem space that is equivalent to the old mem space, and
* use that instead.
*
* Note that in general, this requires us to touch up the memory buffer as
* well.
*/
if (dset_info[i].nelmts > 0 &&
true == H5S_SELECT_SHAPE_SAME(dset_info[i].mem_space, dset_info[i].file_space) &&
H5S_GET_EXTENT_NDIMS(dset_info[i].mem_space) != H5S_GET_EXTENT_NDIMS(dset_info[i].file_space)) {
ptrdiff_t buf_adj = 0;
/* Allocate original memory space buffer if necessary */
if (!orig_mem_space) {
if (count > 1) {
/* Allocate buffer */
if (NULL == (orig_mem_space = (H5S_t **)H5MM_calloc(count * sizeof(H5S_t *))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL,
"couldn't allocate original memory space array buffer");
}
else
/* Use local buffer */
orig_mem_space = &orig_mem_space_local;
}
/* Save original memory space */
orig_mem_space[i] = dset_info[i].mem_space;
dset_info[i].mem_space = NULL;
/* Attempt to construct projected dataspace for memory dataspace */
if (H5S_select_construct_projection(orig_mem_space[i], &dset_info[i].mem_space,
(unsigned)H5S_GET_EXTENT_NDIMS(dset_info[i].file_space),
dset_info[i].type_info.src_type_size, &buf_adj) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to construct projected memory dataspace");
assert(dset_info[i].mem_space);
/* Adjust the buffer by the given amount */
dset_info[i].buf.cvp = (const void *)(((const uint8_t *)dset_info[i].buf.cvp) + buf_adj);
} /* end if */
/* Retrieve dataset properties */
/* <none needed currently> */
/* Set up I/O operation */
if (H5D__dset_ioinfo_init(dset_info[i].dset, &(dset_info[i]), &(store[i])) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up I/O operation");
/* Check if any filters are applied to the dataset */
if (dset_info[i].dset->shared->dcpl_cache.pline.nused > 0)
io_info.filtered_count++;
/* Allocate dataspace and initialize it if it hasn't been. */
should_alloc_space = dset_info[i].dset->shared->dcpl_cache.efl.nused == 0 &&
!(*dset_info[i].dset->shared->layout.ops->is_space_alloc)(
&dset_info[i].dset->shared->layout.storage);
/*
* If not using an MPI-based VFD, we only need to allocate
* and initialize storage if there's a selection in the
* dataset's dataspace. Otherwise, we always need to participate
* in the storage allocation since this may use collective
* operations and we will hang if we don't participate.
*/
if (!H5F_HAS_FEATURE(dset_info[i].dset->oloc.file, H5FD_FEAT_HAS_MPI))
should_alloc_space = should_alloc_space && (dset_info[i].nelmts > 0);
if (should_alloc_space) {
hssize_t file_nelmts; /* Number of elements in file dataset's dataspace */
bool full_overwrite; /* Whether we are over-writing all the elements */
/* Get the number of elements in file dataset's dataspace */
if ((file_nelmts = H5S_GET_EXTENT_NPOINTS(dset_info[i].file_space)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL,
"can't retrieve number of elements in file dataset");
/* Always allow fill values to be written if the dataset has a VL datatype */
if (H5T_detect_class(dset_info[i].dset->shared->type, H5T_VLEN, false))
full_overwrite = false;
else
full_overwrite = (bool)((hsize_t)file_nelmts == dset_info[i].nelmts ? true : false);
/* Allocate storage */
if (H5D__alloc_storage(dset_info[i].dset, H5D_ALLOC_WRITE, full_overwrite, NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage");
} /* end if */
/* Call storage method's I/O initialization routine */
/* Init io_info.dset_info[] and generate piece_info in skip list */
if (dset_info[i].layout_ops.io_init &&
(*dset_info[i].layout_ops.io_init)(&io_info, &(dset_info[i])) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info");
dset_info[i].skip_io = false;
io_op_init++;
/* Reset metadata tagging */
H5AC_tag(prev_tag, NULL);
} /* end of for loop */
assert(io_op_init == count);
/* Perform second phase of type info initialization */
if (H5D__typeinfo_init_phase2(&io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info (second phase)");
#ifdef H5_HAVE_PARALLEL
/* Adjust I/O info for any parallel or selection I/O */
if (H5D__ioinfo_adjust(&io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL,
"unable to adjust I/O info for parallel or selection I/O");
#endif /* H5_HAVE_PARALLEL */
/* Perform third phase of type info initialization */
if (H5D__typeinfo_init_phase3(&io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info (third phase)");
H5CX_set_no_selection_io_cause(io_info.no_selection_io_cause);
/* If multi dataset I/O callback is not provided, perform write IO via
* single-dset path with looping */
if (io_info.md_io_ops.multi_write_md) {
/* Create sel_pieces array if any pieces are selected */
if (io_info.piece_count > 0) {
assert(!io_info.sel_pieces);
assert(io_info.pieces_added == 0);
/* Allocate sel_pieces array */
if (NULL ==
(io_info.sel_pieces = H5MM_malloc(io_info.piece_count * sizeof(io_info.sel_pieces[0]))))
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate array of selected pieces");
}
/* MDIO-specific second phase initialization */
for (i = 0; i < count; i++)
if (dset_info[i].layout_ops.mdio_init) {
haddr_t prev_tag = HADDR_UNDEF;
/* set metadata tagging with dset oheader addr */
H5AC_tag(dset_info[i].dset->oloc.addr, &prev_tag);
/* Make second phase IO init call */
if ((dset_info[i].layout_ops.mdio_init)(&io_info, &(dset_info[i])) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't populate array of selected pieces");
/* Reset metadata tagging */
H5AC_tag(prev_tag, NULL);
}
/* Invoke correct "high level" I/O routine */
if ((*io_info.md_io_ops.multi_write_md)(&io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data");
} /* end if */
else {
haddr_t prev_tag = HADDR_UNDEF;
/* Allocate selection I/O parameter arrays if necessary */
if (!H5D_LAYOUT_CB_PERFORM_IO(&io_info) && io_info.piece_count > 0) {
if (NULL == (io_info.mem_spaces = H5MM_malloc(io_info.piece_count * sizeof(H5S_t *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"memory allocation failed for memory space list");
if (NULL == (io_info.file_spaces = H5MM_malloc(io_info.piece_count * sizeof(H5S_t *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"memory allocation failed for file space list");
if (NULL == (io_info.addrs = H5MM_malloc(io_info.piece_count * sizeof(haddr_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"memory allocation failed for piece address list");
if (NULL == (io_info.element_sizes = H5MM_malloc(io_info.piece_count * sizeof(size_t))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"memory allocation failed for element size list");
if (NULL == (io_info.wbufs = H5MM_malloc(io_info.piece_count * sizeof(const void *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"memory allocation failed for write buffer list");
if (io_info.max_tconv_type_size > 0)
if (NULL ==
(io_info.sel_pieces = H5MM_malloc(io_info.piece_count * sizeof(io_info.sel_pieces[0]))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
"unable to allocate array of selected pieces");
}
/* Loop with serial & single-dset write IO path */
for (i = 0; i < count; i++) {
assert(!dset_info[i].skip_io);
/* Set metadata tagging with dset oheader addr */
H5AC_tag(dset_info->dset->oloc.addr, &prev_tag);
/* Invoke correct "high level" I/O routine */
if ((*dset_info[i].io_ops.multi_write)(&io_info, &dset_info[i]) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data");
/* Reset metadata tagging */
H5AC_tag(prev_tag, NULL);
}
/* Make final selection I/O call if the multi_write callbacks did not perform the actual I/O
* (if using selection I/O and either multi dataset or type conversion) */
if (!H5D_LAYOUT_CB_PERFORM_IO(&io_info)) {
/* Check for type conversion */
if (io_info.max_tconv_type_size > 0) {
/* Type conversion pathway */
if (H5D__scatgath_write_select(&io_info) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "type conversion selection write failed");
}
else {
/* Call selection I/O directly */
H5_CHECK_OVERFLOW(io_info.pieces_added, size_t, uint32_t);
if (H5F_shared_select_write(io_info.f_sh, H5FD_MEM_DRAW, (uint32_t)io_info.pieces_added,
io_info.mem_spaces, io_info.file_spaces, io_info.addrs,
io_info.element_sizes, io_info.wbufs) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "selection write failed");
}
}
#ifdef H5_HAVE_PARALLEL
/* Report the actual I/O mode to the application if appropriate */
if (io_info.using_mpi_vfd) {
H5FD_mpio_xfer_t xfer_mode; /* Parallel transfer for this request */
/* Get the parallel I/O transfer mode */
if (H5CX_get_io_xfer_mode(&xfer_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode");
/* Only report the collective I/O mode if we're actually performing collective I/O */
if (xfer_mode == H5FD_MPIO_COLLECTIVE) {
H5CX_set_mpio_actual_io_mode(io_info.actual_io_mode);
/* If we did selection I/O, report that we used "link chunk" mode, since that's the most
* analogous to what selection I/O does */
if (io_info.use_select_io == H5D_SELECTION_IO_MODE_ON)
H5CX_set_mpio_actual_chunk_opt(H5D_MPIO_LINK_CHUNK);
}
}
#endif /* H5_HAVE_PARALLEL */
}
done:
/* Shut down the I/O op information */
for (i = 0; i < io_op_init; i++) {
assert(!dset_info[i].skip_io);
if (dset_info[i].layout_ops.io_term &&
(*dset_info[i].layout_ops.io_term)(&io_info, &(dset_info[i])) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info");
}
/* Shut down datatype info for operation */
if (H5D__typeinfo_term(&io_info) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info");
/* Discard projected mem spaces and restore originals */
if (orig_mem_space) {
for (i = 0; i < count; i++)
if (orig_mem_space[i]) {
if (H5S_close(dset_info[i].mem_space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL,
"unable to shut down projected memory dataspace");
dset_info[i].mem_space = orig_mem_space[i];
}
/* Free orig_mem_space array if it was allocated */
if (orig_mem_space != &orig_mem_space_local)
H5MM_free(orig_mem_space);
}
/* Free global piece array */
H5MM_xfree(io_info.sel_pieces);
/* Free selection I/O arrays */
H5MM_xfree(io_info.mem_spaces);
H5MM_xfree(io_info.file_spaces);
H5MM_xfree(io_info.addrs);
H5MM_xfree(io_info.element_sizes);
H5MM_xfree(io_info.wbufs);
/* Free store array if it was allocated */
if (store != &store_local)
H5MM_free(store);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__write */
/*-------------------------------------------------------------------------
* Function: H5D__ioinfo_init
*
* Purpose: General setup for H5D_io_info_t struct
*
* Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__ioinfo_init(size_t count, H5D_io_op_type_t op_type, H5D_dset_io_info_t *dset_info,
H5D_io_info_t *io_info)
{
H5D_selection_io_mode_t selection_io_mode;
FUNC_ENTER_PACKAGE_NOERR
/* Check args */
assert(count > 0);
assert(dset_info);
assert(dset_info[0].dset->oloc.file);
assert(io_info);
/* Zero out struct */
memset(io_info, 0, sizeof(*io_info));
/* Set up simple fields */
io_info->op_type = op_type;
io_info->f_sh = count > 0 ? H5F_SHARED(dset_info[0].dset->oloc.file) : NULL;
io_info->count = count;
/* Start without multi-dataset I/O ops. If we're not using the collective
* I/O path then we will call the single dataset callbacks in a loop. */
/* Use provided dset_info */
io_info->dsets_info = dset_info;
/* Start with selection I/O mode from property list. If enabled, layout callback will turn it off if it
* is not supported by the layout. Handling of H5D_SELECTION_IO_MODE_AUTO occurs in H5D__ioinfo_adjust.
*/
H5CX_get_selection_io_mode(&selection_io_mode);
io_info->use_select_io = selection_io_mode;
/* Record no selection I/O cause if it was disabled by the API */
if (selection_io_mode == H5D_SELECTION_IO_MODE_OFF)
io_info->no_selection_io_cause = H5D_SEL_IO_DISABLE_BY_API;
#ifdef H5_HAVE_PARALLEL
/* Determine if the file was opened with an MPI VFD */
if (count > 0)
io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset_info[0].dset->oloc.file, H5FD_FEAT_HAS_MPI);
#endif /* H5_HAVE_PARALLEL */
/* Check if we could potentially use in-place type conversion */
if (op_type == H5D_IO_OP_READ)
/* Always on for read (modulo other restrictions that are handled in layout callbacks) */
io_info->may_use_in_place_tconv = true;
else
/* Only enable in-place type conversion if we're allowed to modify the write buffer */
H5CX_get_modify_write_buf(&io_info->may_use_in_place_tconv);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__ioinfo_init() */
/*-------------------------------------------------------------------------
* Function: H5D__dset_ioinfo_init
*
* Purpose: Routine for determining correct I/O operations for each I/O action.
*
* Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
static herr_t
H5D__dset_ioinfo_init(H5D_t *dset, H5D_dset_io_info_t *dset_info, H5D_storage_t *store)
{
FUNC_ENTER_PACKAGE_NOERR
/* check args */
assert(dset);
assert(dset->oloc.file);
assert(dset_info->type_info.tpath);