1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2006 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2008-2018 University of Houston. All rights reserved.
13 * Copyright (c) 2018 Research Organization for Information Science
14 * and Technology (RIST). All rights reserved.
15 * $COPYRIGHT$
16 *
17 * Additional copyrights may follow
18 *
19 * $HEADER$
20 */
21
22 #ifndef MCA_FBTL_POSIX_H
23 #define MCA_FBTL_POSIX_H
24
25 #include "ompi_config.h"
26 #include "ompi/mca/mca.h"
27 #include "ompi/mca/fbtl/fbtl.h"
28 #include "ompi/mca/common/ompio/common_ompio.h"
29 #include "ompi/mca/common/ompio/common_ompio_request.h"
30
31 extern int mca_fbtl_posix_priority;
32
33 BEGIN_C_DECLS
34
35 int mca_fbtl_posix_component_init_query(bool enable_progress_threads,
36 bool enable_mpi_threads);
37 struct mca_fbtl_base_module_1_0_0_t *
38 mca_fbtl_posix_component_file_query (ompio_file_t *file, int *priority);
39 int mca_fbtl_posix_component_file_unquery (ompio_file_t *file);
40
41 int mca_fbtl_posix_module_init (ompio_file_t *file);
42 int mca_fbtl_posix_module_finalize (ompio_file_t *file);
43
44 extern int fbtl_posix_max_aio_active_reqs;
45
46 OMPI_MODULE_DECLSPEC extern mca_fbtl_base_component_2_0_0_t mca_fbtl_posix_component;
47 /*
48 * ******************************************************************
49 * ********* functions which are implemented in this module *********
50 * ******************************************************************
51 */
52
53 ssize_t mca_fbtl_posix_preadv (ompio_file_t *file );
54 ssize_t mca_fbtl_posix_pwritev (ompio_file_t *file );
55 ssize_t mca_fbtl_posix_ipreadv (ompio_file_t *file,
56 ompi_request_t *request);
57 ssize_t mca_fbtl_posix_ipwritev (ompio_file_t *file,
58 ompi_request_t *request);
59
60 bool mca_fbtl_posix_progress ( mca_ompio_request_t *req);
61 void mca_fbtl_posix_request_free ( mca_ompio_request_t *req);
62
63 int mca_fbtl_posix_lock ( struct flock *lock, ompio_file_t *fh, int op,
64 OMPI_MPI_OFFSET_TYPE iov_offset, off_t len, int flags);
65 void mca_fbtl_posix_unlock ( struct flock *lock, ompio_file_t *fh );
66
67
68 struct mca_fbtl_posix_request_data_t {
69 int aio_req_count; /* total number of aio reqs */
70 int aio_open_reqs; /* number of unfinished reqs */
71 int aio_req_type; /* read or write */
72 int aio_req_chunks; /* max. no. of aio reqs that can be posted at once*/
73 int aio_first_active_req; /* first active posted req */
74 int aio_last_active_req; /* last currently active poted req */
75 struct aiocb *aio_reqs; /* pointer array of req structures */
76 int *aio_req_status; /* array of statuses */
77 ssize_t aio_total_len; /* total amount of data written */
78 struct flock aio_lock; /* lock used for certain file systems */
79 ompio_file_t *aio_fh; /* pointer back to the mca_io_ompio_fh structure */
80 };
81 typedef struct mca_fbtl_posix_request_data_t mca_fbtl_posix_request_data_t;
82
83 /* Right now statically defined, will become a configure check */
84 #define FBTL_POSIX_HAVE_AIO 1
85
86 /* define constants for AIO requests */
87 #define FBTL_POSIX_READ 1
88 #define FBTL_POSIX_WRITE 2
89
90
91 /*
92 * ******************************************************************
93 * ************ functions implemented in this module end ************
94 * ******************************************************************
95 */
96
97 END_C_DECLS
98
99 #endif /* MCA_FBTL_POSIX_H */