Motr  M0
tx_bulk.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2015-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #pragma once
24 
25 #ifndef __MOTR_BE_TX_BULK_H__
26 #define __MOTR_BE_TX_BULK_H__
27 
28 #include "lib/types.h" /* uint32_t */
29 #include "lib/mutex.h" /* m0_mutex */
30 
31 #include "be/queue.h" /* m0_be_queue */
32 #include "be/op.h" /* m0_be_op */
33 
50 struct m0_be_op;
51 struct m0_be_domain;
52 struct m0_be_tx_credit;
53 struct m0_be_tx;
54 struct m0_be_tx_bulk;
55 struct be_tx_bulk_worker;
56 
66  uint64_t tbc_workers_nr;
72  void *tbc_datum;
74  void (*tbc_do)(struct m0_be_tx_bulk *tb,
75  struct m0_be_tx *tx,
76  struct m0_be_op *op,
77  void *datum,
78  void *user,
79  uint64_t worker_index,
80  uint64_t partition);
82  void (*tbc_done)(struct m0_be_tx_bulk *tb,
83  void *datum,
84  void *user,
85  uint64_t worker_index,
86  uint64_t partition);
87 };
88 
89 struct m0_be_tx_bulk {
91  struct m0_be_queue *btb_q;
92  uint32_t btb_worker_nr;
95  int btb_rc;
98  uint32_t btb_done_nr;
100  bool btb_done;
102  struct m0_be_op *btb_op;
104 };
105 
106 M0_INTERNAL int m0_be_tx_bulk_init(struct m0_be_tx_bulk *tb,
107  struct m0_be_tx_bulk_cfg *tb_cfg);
108 M0_INTERNAL void m0_be_tx_bulk_fini(struct m0_be_tx_bulk *tb);
109 
114 M0_INTERNAL void m0_be_tx_bulk_run(struct m0_be_tx_bulk *tb,
115  struct m0_be_op *op);
116 
118 M0_INTERNAL bool m0_be_tx_bulk_put(struct m0_be_tx_bulk *tb,
119  struct m0_be_op *op,
120  struct m0_be_tx_credit *credit,
121  m0_bcount_t payload_credit,
122  uint64_t partition,
123  void *user);
124 /* No new work is expected after this function is called. */
125 M0_INTERNAL void m0_be_tx_bulk_end(struct m0_be_tx_bulk *tb);
126 
131 M0_INTERNAL int m0_be_tx_bulk_status(struct m0_be_tx_bulk *tb);
132 
133 
135 #endif /* __MOTR_BE_TX_BULK_H__ */
136 
137 /*
138  * Local variables:
139  * c-indentation-style: "K&R"
140  * c-basic-offset: 8
141  * tab-width: 8
142  * fill-column: 80
143  * scroll-step: 1
144  * End:
145  */
146 /*
147  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
148  */
bool btb_tx_open_failed
Definition: tx_bulk.h:99
M0_INTERNAL void m0_be_tx_bulk_run(struct m0_be_tx_bulk *tb, struct m0_be_op *op)
Definition: tx_bulk.c:565
M0_INTERNAL int m0_be_tx_bulk_init(struct m0_be_tx_bulk *tb, struct m0_be_tx_bulk_cfg *tb_cfg)
Definition: tx_bulk.c:136
uint32_t btb_worker_nr
Definition: tx_bulk.h:92
M0_INTERNAL void m0_be_tx_bulk_end(struct m0_be_tx_bulk *tb)
Definition: tx_bulk.c:619
struct m0_be_queue * btb_q
Definition: tx_bulk.h:91
struct m0_be_domain * tbc_dom
Definition: tx_bulk.h:70
uint64_t m0_bcount_t
Definition: types.h:77
void(* tbc_do)(struct m0_be_tx_bulk *tb, struct m0_be_tx *tx, struct m0_be_op *op, void *datum, void *user, uint64_t worker_index, uint64_t partition)
Definition: tx_bulk.h:74
int btb_rc
Definition: tx_bulk.h:95
op
Definition: libdemo.c:64
uint64_t tbc_partitions_nr
Definition: tx_bulk.h:67
struct m0_mutex btb_lock
Definition: tx_bulk.h:97
bool btb_done
Definition: tx_bulk.h:100
uint64_t tbc_workers_nr
Definition: tx_bulk.h:66
M0_INTERNAL int m0_be_tx_bulk_status(struct m0_be_tx_bulk *tb)
Definition: tx_bulk.c:630
uint32_t btb_done_nr
Definition: tx_bulk.h:98
void * tbc_datum
Definition: tx_bulk.h:72
uint64_t tbc_work_items_per_tx_max
Definition: tx_bulk.h:68
M0_INTERNAL bool m0_be_tx_bulk_put(struct m0_be_tx_bulk *tb, struct m0_be_op *op, struct m0_be_tx_credit *credit, m0_bcount_t payload_credit, uint64_t partition, void *user)
Definition: tx_bulk.c:583
M0_INTERNAL void m0_be_tx_bulk_fini(struct m0_be_tx_bulk *tb)
Definition: tx_bulk.c:288
struct m0_be_op btb_kill_put_op
Definition: tx_bulk.h:103
void(* tbc_done)(struct m0_be_tx_bulk *tb, void *datum, void *user, uint64_t worker_index, uint64_t partition)
Definition: tx_bulk.h:82
struct m0_be_tx_bulk_cfg btb_cfg
Definition: tx_bulk.h:90
Definition: op.h:74
bool btb_termination_in_progress
Definition: tx_bulk.h:101
Definition: mutex.h:47
struct m0_be_queue_cfg tbc_q_cfg
Definition: tx_bulk.h:65
Definition: tx.h:280
struct m0_be_op * btb_op
Definition: tx_bulk.h:102
struct be_tx_bulk_worker * btb_worker
Definition: tx_bulk.h:93