Motr  M0
cp.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2017-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_DIX_CM_CP_H__
26 #define __MOTR_DIX_CM_CP_H__
27 
28 #include "fid/fid.h" /* m0_fid */
29 #include "fop/fom_long_lock.h" /* m0_long_lock_link */
30 #include "rpc/at.h" /* m0_rpc_at_buf */
31 #include "cas/ctg_store.h" /* m0_ctg_op */
32 #include "cm/cp.h" /* m0_cm_cp */
33 
40 /* Import */
41 struct m0_fom;
42 struct m0_cm;
43 
44 extern const struct m0_cm_cp_ops m0_dix_cm_repair_cp_ops;
45 extern const struct m0_cm_cp_ops m0_dix_cm_rebalance_cp_ops;
46 
48 struct m0_dix_cm_cp {
50  struct m0_cm_cp dc_base;
51 
54 
60 
66 
69 
71  uint32_t dc_ctg_op_flags;
72 
74  struct m0_cas_ctg *dc_ctg;
75 
80 
85 
88 
90  struct m0_buf dc_key;
92  struct m0_buf dc_val;
93 };
94 
103 };
104 
112 M0_INTERNAL struct m0_dix_cm_cp *cp2dixcp(const struct m0_cm_cp *cp);
113 
121 M0_INTERNAL uint64_t m0_dix_cm_cp_home_loc_helper(const struct m0_cm_cp *cp);
122 
130 M0_INTERNAL struct m0_cm *cpfom2cm(struct m0_fom *fom);
131 
133 M0_INTERNAL bool m0_dix_cm_cp_invariant(const struct m0_cm_cp *cp);
134 
142 M0_INTERNAL struct m0_cm_cp *m0_dix_cm_cp_alloc(struct m0_cm *cm);
143 
152 M0_INTERNAL int m0_dix_cm_cp_init(struct m0_cm_cp *cp);
153 
163 M0_INTERNAL int m0_dix_cm_cp_fail(struct m0_cm_cp *cp,
164  struct m0_fop_type *ft);
165 
174 M0_INTERNAL int m0_dix_cm_cp_read(struct m0_cm_cp *cp);
175 
183 M0_INTERNAL int m0_dix_cm_cp_xform(struct m0_cm_cp *cp);
184 
192 M0_INTERNAL int m0_dix_cm_cp_write(struct m0_cm_cp *cp);
193 
201 M0_INTERNAL int m0_dix_cm_cp_write_pre(struct m0_cm_cp *cp);
202 
211 M0_INTERNAL int m0_dix_cm_cp_io_wait(struct m0_cm_cp *cp,
212  struct m0_fop_type *ft);
213 
222 M0_INTERNAL int m0_dix_cm_cp_sw_check(struct m0_cm_cp *cp);
223 
232 M0_INTERNAL int m0_dix_cm_cp_send(struct m0_cm_cp *cp, struct m0_fop_type *ft);
233 
242 M0_INTERNAL int m0_dix_cm_cp_send_wait(struct m0_cm_cp *cp);
243 
251 M0_INTERNAL int m0_dix_cm_cp_recv_init(struct m0_cm_cp *cp);
252 
261 M0_INTERNAL int m0_dix_cm_cp_recv_wait(struct m0_cm_cp *cp);
262 
268 M0_INTERNAL void m0_dix_cm_cp_complete(struct m0_cm_cp *cp);
269 
276 M0_INTERNAL void m0_dix_cm_cp_free(struct m0_cm_cp *cp);
277 
286 M0_INTERNAL int m0_dix_cm_cp_fini(struct m0_cm_cp *cp);
287 
294 M0_INTERNAL void m0_dix_cm_cp_tgt_info_fill(struct m0_dix_cm_cp *dix_cp,
295  const struct m0_fid *cctg_fid);
296 
304 M0_INTERNAL void m0_dix_cm_cp_setup(struct m0_dix_cm_cp *dix_cp,
305  const struct m0_fid *cctg_fid,
306  uint64_t failed_unit_index);
307 
316 M0_INTERNAL int m0_dix_cm_cp_dup(struct m0_cm_cp *src, struct m0_cm_cp **dst);
317 
319 #endif /* __MOTR_DIX_CM_CP_H__ */
320 /*
321  * Local variables:
322  * c-indentation-style: "K&R"
323  * c-basic-offset: 8
324  * tab-width: 8
325  * fill-column: 80
326  * scroll-step: 1
327  * End:
328  */
M0_INTERNAL uint64_t m0_dix_cm_cp_home_loc_helper(const struct m0_cm_cp *cp)
Definition: cp.c:74
M0_INTERNAL int m0_dix_cm_cp_io_wait(struct m0_cm_cp *cp, struct m0_fop_type *ft)
Definition: cp.c:479
m0_dix_cm_phase_transmit
Definition: cp.h:96
static struct m0_bufvec dst
Definition: xform.c:61
M0_INTERNAL int m0_dix_cm_cp_send(struct m0_cm_cp *cp, struct m0_fop_type *ft)
Definition: net.c:139
const struct m0_cm_cp_ops m0_dix_cm_repair_cp_ops
Definition: cm.h:171
Definition: cp.h:160
struct m0_long_lock_link dc_meta_lock
Definition: cp.h:79
M0_INTERNAL int m0_dix_cm_cp_init(struct m0_cm_cp *cp)
Definition: cp.c:175
struct m0_fid dc_ctg_fid
Definition: cp.h:53
M0_INTERNAL int m0_dix_cm_cp_send_wait(struct m0_cm_cp *cp)
Definition: net.c:204
M0_INTERNAL int m0_dix_cm_cp_dup(struct m0_cm_cp *src, struct m0_cm_cp **dst)
Definition: cp.c:320
struct m0_buf dc_key
Definition: cp.h:90
M0_INTERNAL int m0_dix_cm_cp_read(struct m0_cm_cp *cp)
Definition: cp.c:337
M0_INTERNAL int m0_dix_cm_cp_fini(struct m0_cm_cp *cp)
Definition: cp.c:286
static struct m0_cm * cm
Definition: cm.c:63
struct m0_cas_ctg * dc_ctg
Definition: cp.h:74
Definition: buf.h:37
uint32_t dc_ctg_op_flags
Definition: cp.h:71
M0_INTERNAL void m0_dix_cm_cp_free(struct m0_cm_cp *cp)
Definition: cp.c:277
struct m0_long_lock_link dc_ctg_lock
Definition: cp.h:77
M0_INTERNAL int m0_dix_cm_cp_recv_init(struct m0_cm_cp *cp)
Definition: net.c:219
M0_INTERNAL bool m0_dix_cm_cp_invariant(const struct m0_cm_cp *cp)
Definition: cp.c:62
struct m0_buf dc_val
Definition: cp.h:92
Definition: cp.h:102
M0_INTERNAL int m0_dix_cm_cp_xform(struct m0_cm_cp *cp)
Definition: cp.c:346
M0_INTERNAL struct m0_cm * cpfom2cm(struct m0_fom *fom)
Definition: cp.c:72
M0_INTERNAL int m0_dix_cm_cp_write(struct m0_cm_cp *cp)
Definition: cp.c:413
struct m0_long_lock_addb2 dc_ctg_lock_addb2
Definition: cp.h:82
Definition: dump.c:103
const struct m0_cm_cp_ops m0_dix_cm_rebalance_cp_ops
Definition: cm.h:172
struct m0_long_lock_addb2 dc_meta_lock_addb2
Definition: cp.h:84
M0_INTERNAL struct m0_cm_cp * m0_dix_cm_cp_alloc(struct m0_cm *cm)
Definition: cp.c:90
struct m0_ctg_op dc_ctg_op
Definition: cp.h:65
Definition: cp.h:98
M0_INTERNAL int m0_dix_cm_cp_recv_wait(struct m0_cm_cp *cp)
Definition: net.c:233
Definition: fom.h:481
int dc_phase_transmit
Definition: cp.h:87
Definition: fid.h:38
Definition: cm.h:166
int dc_ctg_op_rc
Definition: cp.h:68
bool dc_is_local
Definition: cp.h:59
M0_INTERNAL void m0_dix_cm_cp_complete(struct m0_cm_cp *cp)
Definition: cp.c:259
M0_INTERNAL void m0_dix_cm_cp_tgt_info_fill(struct m0_dix_cm_cp *dix_cp, const struct m0_fid *cctg_fid)
Definition: cp.c:304
M0_INTERNAL void m0_dix_cm_cp_setup(struct m0_dix_cm_cp *dix_cp, const struct m0_fid *cctg_fid, uint64_t failed_unit_index)
Definition: cp.c:310
M0_INTERNAL int m0_dix_cm_cp_sw_check(struct m0_cm_cp *cp)
Definition: net.c:256
static struct m0_fop_type * ft[]
Definition: service_ut.c:856
M0_INTERNAL int m0_dix_cm_cp_fail(struct m0_cm_cp *cp, struct m0_fop_type *ft)
Definition: cp.c:230
M0_INTERNAL struct m0_dix_cm_cp * cp2dixcp(const struct m0_cm_cp *cp)
Definition: cp.c:50
struct m0_pdclust_src_addr src
Definition: fd.c:108
struct m0_cm_cp dc_base
Definition: cp.h:50
M0_INTERNAL int m0_dix_cm_cp_write_pre(struct m0_cm_cp *cp)
Definition: cp.c:357
Definition: cp.h:100