Motr  M0
cp.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2013-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_CM_CP_H__
26 #define __MOTR_CM_CP_H__
27 
28 #include "lib/vec.h"
29 #include "lib/tlist.h"
30 #include "net/net.h"
31 #include "net/buffer_pool.h"
32 
33 #include "fop/fom_generic.h"
34 #include "rpc/bulk.h"
35 #include "fop/fop.h"
36 
69 struct m0_cm_cp;
70 struct m0_cm;
71 struct m0_cm_type;
72 
76 enum {
77  M0_CP_SIZE = 4096
78 };
79 
91 };
92 
97 };
98 
103 
109 
112 
115 
118 
121 
124 
127 
130 
136 
139 
142 
145 
148 
150 
152 };
153 
154 struct m0_cm_cp_fop {
155  struct m0_fop cf_fop;
156  struct m0_cm_cp *cf_cp;
157 };
158 
160 struct m0_cm_cp {
161  struct m0_fom c_fom;
164 
167 
169  const struct m0_cm_cp_ops *c_ops;
170 
173 
175  uint64_t c_ag_cp_idx;
176 
182 
184  struct m0_tl c_buffers;
185 
187  uint32_t c_buf_nr;
188 
190  uint32_t c_data_seg_nr;
191 
194 
197 
206 
209 
217 
218  int c_rc;
219 
220  uint64_t c_magix;
221 };
222 
226 struct m0_cm_cp_ops {
232  int (*co_phase_next) (struct m0_cm_cp *cp);
233 
235  bool (*co_invariant) (const struct m0_cm_cp *cp);
236 
241  uint64_t (*co_home_loc_helper) (const struct m0_cm_cp *cp);
242 
244  void (*co_complete) (struct m0_cm_cp *cp);
245 
250  void (*co_free)(struct m0_cm_cp *cp);
251 
253  uint32_t co_action_nr;
254 
259  int (*co_action[]) (struct m0_cm_cp *cp);
260 };
261 
262 M0_INTERNAL void m0_cm_cp_init(struct m0_cm_type *cmtype,
263  const struct m0_fom_type_ops *ft_ops);
264 
268 M0_INTERNAL void m0_cm_cp_only_init(struct m0_cm *cm, struct m0_cm_cp *cp);
269 
270 M0_INTERNAL int m0_cm_cp_fom_create(struct m0_fop *fop, struct m0_fop *r_fop,
271  struct m0_fom **m, struct m0_reqh *reqh);
278 M0_INTERNAL void m0_cm_cp_fom_init(struct m0_cm *cm, struct m0_cm_cp *cp,
279  struct m0_fop *fop, struct m0_fop *r_fop);
280 
281 M0_INTERNAL void m0_cm_cp_fom_fini(struct m0_fom *fom);
282 
286 M0_INTERNAL void m0_cm_cp_only_fini(struct m0_cm_cp *cp);
287 
293 M0_INTERNAL void m0_cm_cp_fini(struct m0_cm_cp *cp);
294 
296 M0_INTERNAL int m0_cm_cp_enqueue(struct m0_cm *cm, struct m0_cm_cp *cp);
297 
298 M0_INTERNAL bool m0_cm_cp_invariant(const struct m0_cm_cp *cp);
299 
300 M0_INTERNAL void m0_cm_cp_buf_add(struct m0_cm_cp *cp,
301  struct m0_net_buffer *nb);
302 
303 M0_INTERNAL void m0_cm_cp_buf_release(struct m0_cm_cp *cp);
304 
305 M0_INTERNAL uint64_t m0_cm_cp_nr(struct m0_cm_cp *cp);
306 
312 M0_INTERNAL int m0_cm_cp_bufvec_merge(struct m0_cm_cp *cp);
313 M0_INTERNAL int m0_cm_cp_bufvec_split(struct m0_cm_cp *cp);
314 M0_INTERNAL void m0_cm_cp_buf_move(struct m0_cm_cp *src, struct m0_cm_cp *dest);
321 M0_INTERNAL int m0_cm_cp_dup(struct m0_cm_cp *src, struct m0_cm_cp **dest);
322 
323 M0_INTERNAL void m0_cm_cp_data_copy(struct m0_cm_cp *src, struct m0_cm_cp *dst);
324 
325 M0_TL_DESCR_DECLARE(cp_data_buf, M0_EXTERN);
326 M0_TL_DECLARE(cp_data_buf, M0_INTERNAL, struct m0_net_buffer);
327 
332 #endif /* __MOTR_CM_CP_H__ */
333 /*
334  * Local variables:
335  * c-indentation-style: "K&R"
336  * c-basic-offset: 8
337  * tab-width: 8
338  * fill-column: 80
339  * scroll-step: 1
340  * End:
341  */
M0_INTERNAL void m0_cm_cp_buf_release(struct m0_cm_cp *cp)
Definition: cp.c:713
bool(* co_invariant)(const struct m0_cm_cp *cp)
Definition: cp.h:235
M0_INTERNAL void m0_cm_cp_only_fini(struct m0_cm_cp *cp)
Definition: cp.c:626
M0_INTERNAL void m0_cm_cp_fom_fini(struct m0_fom *fom)
Definition: cp.c:412
struct m0_chan c_reply_wait
Definition: cp.h:215
static struct m0_bufvec dst
Definition: xform.c:61
static struct m0_addb2_mach * m
Definition: consumer.c:38
struct m0_bitmap c_xform_cp_indices
Definition: cp.h:181
uint64_t m0_time_t
Definition: time.h:37
Definition: cp.h:160
struct m0_mutex c_reply_wait_mutex
Definition: cp.h:216
M0_INTERNAL int m0_cm_cp_fom_create(struct m0_fop *fop, struct m0_fop *r_fop, struct m0_fom **m, struct m0_reqh *reqh)
Definition: cp.c:454
M0_INTERNAL void m0_cm_cp_fom_init(struct m0_cm *cm, struct m0_cm_cp *cp, struct m0_fop *fop, struct m0_fop *r_fop)
Definition: cp.c:610
M0_INTERNAL int m0_cm_cp_bufvec_split(struct m0_cm_cp *cp)
Definition: cp.c:768
uint64_t c_ag_cp_idx
Definition: cp.h:175
M0_INTERNAL void m0_cm_cp_only_init(struct m0_cm *cm, struct m0_cm_cp *cp)
Definition: cp.c:597
m0_cm_cp_io_op
Definition: cp.h:94
uint64_t c_magix
Definition: cp.h:220
static struct m0_cm * cm
Definition: cm.c:63
M0_INTERNAL int m0_cm_cp_dup(struct m0_cm_cp *src, struct m0_cm_cp **dest)
Definition: cp.c:805
Definition: cp.h:151
M0_INTERNAL void m0_cm_cp_data_copy(struct m0_cm_cp *src, struct m0_cm_cp *dst)
Definition: cp.c:828
enum m0_cm_cp_io_op c_io_op
Definition: cp.h:196
struct m0_tlink c_cm_proxy_linkage
Definition: cp.h:205
struct m0_rpc_bulk c_bulk
Definition: cp.h:193
M0_INTERNAL void m0_cm_cp_buf_move(struct m0_cm_cp *src, struct m0_cm_cp *dest)
Definition: cp.c:793
int c_rc
Definition: cp.h:218
uint32_t c_data_seg_nr
Definition: cp.h:190
Definition: tlist.h:251
M0_TL_DESCR_DECLARE(cp_data_buf, M0_EXTERN)
M0_INTERNAL void m0_cm_cp_fini(struct m0_cm_cp *cp)
Definition: cp.c:682
const struct m0_cm_cp_ops * c_ops
Definition: cp.h:169
M0_INTERNAL void m0_cm_cp_buf_add(struct m0_cm_cp *cp, struct m0_net_buffer *nb)
Definition: cp.c:703
int(* co_action[])(struct m0_cm_cp *cp)
Definition: cp.h:259
m0_cm_cp_priority
Definition: cp.h:87
M0_TL_DECLARE(cp_data_buf, M0_INTERNAL, struct m0_net_buffer)
Definition: reqh.h:94
Definition: dump.c:103
Definition: chan.h:229
struct m0_cm_aggr_group * c_ag
Definition: cp.h:172
uint32_t co_action_nr
Definition: cp.h:253
M0_INTERNAL int m0_cm_cp_bufvec_merge(struct m0_cm_cp *cp)
Definition: cp.c:752
m0_time_t c_epoch
Definition: cp.h:166
Definition: fom.h:481
Definition: cm.h:143
M0_INTERNAL int m0_cm_cp_enqueue(struct m0_cm *cm, struct m0_cm_cp *cp)
Definition: cp.c:688
uint32_t c_buf_nr
Definition: cp.h:187
struct m0_reqh reqh
Definition: rm_foms.c:48
struct m0_cm_proxy * c_cm_proxy
Definition: cp.h:208
struct m0_cm_cp * cf_cp
Definition: cp.h:156
void(* co_complete)(struct m0_cm_cp *cp)
Definition: cp.h:244
Definition: cm.h:166
static struct m0_fop * fop
Definition: item.c:57
int(* co_phase_next)(struct m0_cm_cp *cp)
Definition: cp.h:232
void(* co_free)(struct m0_cm_cp *cp)
Definition: cp.h:250
uint64_t(* co_home_loc_helper)(const struct m0_cm_cp *cp)
Definition: cp.h:241
struct m0_tl c_buffers
Definition: cp.h:184
M0_INTERNAL void m0_cm_cp_init(struct m0_cm_type *cmtype, const struct m0_fom_type_ops *ft_ops)
Definition: cp.c:580
struct m0_fop cf_fop
Definition: cp.h:155
enum m0_cm_cp_priority c_prio
Definition: cp.h:163
struct m0_fom c_fom
Definition: cp.h:161
M0_INTERNAL uint64_t m0_cm_cp_nr(struct m0_cm_cp *cp)
Definition: cp.c:738
Definition: cp.h:77
Definition: mutex.h:47
M0_INTERNAL bool m0_cm_cp_invariant(const struct m0_cm_cp *cp)
Definition: cp.c:587
struct m0_pdclust_src_addr src
Definition: fd.c:108
m0_cm_cp_phase
Definition: cp.h:100
Definition: fop.h:79