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_SNS_CM_CP_H__
26 #define __MOTR_SNS_CM_CP_H__
27 
28 #include "cm/cp.h"
29 #include "be/engine.h" /* struct m0_stob_io */
30 #include "be/extmap.h" /* struct m0_be_emap */
31 
38 struct m0_sns_cm_cp {
39  struct m0_cm_cp sc_base;
40 
42  struct m0_fid sc_cobfid;
43 
46 
54 
55  uint64_t sc_failed_idx;
56 
57  bool sc_is_acc;
58 
61 
64 
66  struct m0_stob *sc_stob;
67 
79 
81 
84 };
85 
86 M0_INTERNAL struct m0_sns_cm_cp *cp2snscp(const struct m0_cm_cp *cp);
87 
92 M0_INTERNAL uint64_t cp_home_loc_helper(const struct m0_cm_cp *cp);
93 M0_INTERNAL struct m0_cm *cpfom2cm(struct m0_fom *fom);
94 
95 M0_INTERNAL bool m0_sns_cm_cp_invariant(const struct m0_cm_cp *cp);
96 
97 extern const struct m0_cm_cp_ops m0_sns_cm_repair_cp_ops;
98 extern const struct m0_cm_cp_ops m0_sns_cm_rebalance_cp_ops;
99 extern const struct m0_cm_cp_ops m0_sns_cm_acc_cp_ops;
100 
101 M0_INTERNAL int m0_sns_cm_cp_init(struct m0_cm_cp *cp);
102 M0_INTERNAL int m0_sns_cm_cp_fail(struct m0_cm_cp *cp);
103 
105 M0_INTERNAL int m0_sns_cm_cp_read(struct m0_cm_cp *cp);
106 
107 M0_INTERNAL int m0_sns_cm_cp_write_pre(struct m0_cm_cp *cp);
108 
110 M0_INTERNAL int m0_sns_cm_cp_write(struct m0_cm_cp *cp);
111 
113 M0_INTERNAL int m0_sns_cm_cp_io_wait(struct m0_cm_cp *cp);
114 
115 M0_INTERNAL int m0_sns_cm_cp_sw_check(struct m0_cm_cp *cp);
116 
117 M0_INTERNAL int m0_sns_cm_cp_send(struct m0_cm_cp *cp, struct m0_fop_type *ft);
118 
119 M0_INTERNAL int m0_sns_cm_cp_send_wait(struct m0_cm_cp *cp);
120 
121 M0_INTERNAL int m0_sns_cm_cp_buf_acquire(struct m0_cm_cp *cp);
122 
123 M0_INTERNAL int m0_sns_cm_cp_recv_init(struct m0_cm_cp *cp);
124 
125 M0_INTERNAL int m0_sns_cm_cp_recv_wait(struct m0_cm_cp *cp);
126 
127 M0_INTERNAL void m0_sns_cm_cp_complete(struct m0_cm_cp *cp);
128 
129 M0_INTERNAL int m0_sns_cm_cp_phase_next(struct m0_cm_cp *cp);
130 
131 M0_INTERNAL void m0_sns_cm_cp_free(struct m0_cm_cp *cp);
132 
133 M0_INTERNAL int m0_sns_cm_cp_fini(struct m0_cm_cp *cp);
134 
135 M0_INTERNAL int m0_sns_cm_cp_next_phase_get(int phase, struct m0_cm_cp *cp);
136 
137 M0_INTERNAL void m0_sns_cm_cp_tgt_info_fill(struct m0_sns_cm_cp *scp,
138  const struct m0_fid *cob_fid,
139  uint64_t stob_offset,
140  uint64_t ag_cp_idx);
141 
142 M0_INTERNAL int m0_sns_cm_cp_setup(struct m0_sns_cm_cp *scp,
143  const struct m0_fid *cob_fid,
144  uint64_t stob_offset,
145  uint64_t data_seg_nr,
146  uint64_t failed_unit_index,
147  uint64_t ag_cp_idx);
148 
149 M0_INTERNAL void m0_sns_cm_cp_buf_release(struct m0_cm_cp *cp);
150 M0_INTERNAL int m0_sns_cm_cp_dup(struct m0_cm_cp *src, struct m0_cm_cp **dest);
151 M0_INTERNAL int m0_sns_cm_cp_tx_open(struct m0_cm_cp *cp);
152 M0_INTERNAL int m0_sns_cm_cp_tx_close(struct m0_cm_cp *cp);
153 M0_INTERNAL struct m0_cob_domain *m0_sns_cm_cp2cdom(struct m0_cm_cp *cp);
154 
156 #endif /* __MOTR_SNS_CM_CP_H__ */
157 /*
158  * Local variables:
159  * c-indentation-style: "K&R"
160  * c-basic-offset: 8
161  * tab-width: 8
162  * fill-column: 80
163  * scroll-step: 1
164  * End:
165  */
M0_INTERNAL void m0_sns_cm_cp_free(struct m0_cm_cp *cp)
Definition: cp.c:338
M0_INTERNAL int m0_sns_cm_cp_init(struct m0_cm_cp *cp)
Definition: cp.c:100
M0_INTERNAL int m0_sns_cm_cp_send(struct m0_cm_cp *cp, struct m0_fop_type *ft)
Definition: net.c:195
M0_INTERNAL void m0_sns_cm_cp_tgt_info_fill(struct m0_sns_cm_cp *scp, const struct m0_fid *cob_fid, uint64_t stob_offset, uint64_t ag_cp_idx)
Definition: cp.c:357
M0_INTERNAL int m0_sns_cm_cp_send_wait(struct m0_cm_cp *cp)
Definition: net.c:297
struct m0_stob_id sc_stob_id
Definition: cp.h:45
M0_INTERNAL struct m0_cob_domain * m0_sns_cm_cp2cdom(struct m0_cm_cp *cp)
Definition: storage.c:189
M0_INTERNAL int m0_sns_cm_cp_buf_acquire(struct m0_cm_cp *cp)
Definition: cp.h:160
M0_INTERNAL int m0_sns_cm_cp_recv_wait(struct m0_cm_cp *cp)
Definition: net.c:512
M0_INTERNAL void m0_sns_cm_cp_complete(struct m0_cm_cp *cp)
Definition: cp.c:307
uint64_t m0_bindex_t
Definition: types.h:80
struct m0_stob * sc_stob
Definition: cp.h:66
M0_INTERNAL int m0_sns_cm_cp_write_pre(struct m0_cm_cp *cp)
Definition: storage.c:330
struct m0_fid sc_cobfid
Definition: cp.h:42
const struct m0_cm_cp_ops m0_sns_cm_repair_cp_ops
Definition: cp.c:421
struct m0_cm_cp sc_base
Definition: cp.h:39
M0_INTERNAL int m0_sns_cm_cp_recv_init(struct m0_cm_cp *cp)
Definition: net.c:432
Definition: stob.h:163
M0_INTERNAL int m0_sns_cm_cp_write(struct m0_cm_cp *cp)
Definition: storage.c:335
struct m0_stob_io sc_stio
Definition: cp.h:63
M0_INTERNAL int m0_sns_cm_cp_io_wait(struct m0_cm_cp *cp)
Definition: storage.c:341
M0_INTERNAL int m0_sns_cm_cp_phase_next(struct m0_cm_cp *cp)
Definition: cp.c:261
m0_bindex_t sc_index
Definition: cp.h:60
M0_INTERNAL int m0_sns_cm_cp_dup(struct m0_cm_cp *src, struct m0_cm_cp **dest)
Definition: cp.c:400
const struct m0_cm_cp_ops m0_sns_cm_rebalance_cp_ops
Definition: cp.c:446
static struct m0_fid cob_fid
Definition: net.c:116
M0_INTERNAL int m0_sns_cm_cp_setup(struct m0_sns_cm_cp *scp, const struct m0_fid *cob_fid, uint64_t stob_offset, uint64_t data_seg_nr, uint64_t failed_unit_index, uint64_t ag_cp_idx)
Definition: cp.c:368
M0_INTERNAL bool m0_sns_cm_cp_invariant(const struct m0_cm_cp *cp)
Definition: cp.c:62
const struct m0_cm_cp_ops m0_sns_cm_acc_cp_ops
Definition: acc_cp.c:80
M0_INTERNAL struct m0_cm * cpfom2cm(struct m0_fom *fom)
Definition: cp.c:72
Definition: dump.c:103
Definition: io.h:285
uint64_t sc_failed_idx
Definition: cp.h:55
M0_INTERNAL struct m0_sns_cm_cp * cp2snscp(const struct m0_cm_cp *cp)
Definition: cp.c:57
M0_INTERNAL int m0_sns_cm_cp_tx_open(struct m0_cm_cp *cp)
Definition: cp.c:146
bool sc_is_hole_eof
Definition: cp.h:80
bool sc_spare_punch
Definition: cp.h:78
Definition: fom.h:481
M0_INTERNAL int m0_sns_cm_cp_read(struct m0_cm_cp *cp)
Definition: storage.c:324
Definition: fid.h:38
static struct m0_sns_cm_cp scp
Definition: cm.c:65
bool sc_is_local
Definition: cp.h:53
Definition: cm.h:166
M0_INTERNAL int m0_sns_cm_cp_fail(struct m0_cm_cp *cp)
Definition: cp.c:216
M0_INTERNAL void m0_sns_cm_cp_buf_release(struct m0_cm_cp *cp)
Definition: cp.c:326
static struct m0_fop_type * ft[]
Definition: service_ut.c:856
M0_INTERNAL int m0_sns_cm_cp_tx_close(struct m0_cm_cp *cp)
Definition: cp.c:187
M0_INTERNAL int m0_sns_cm_cp_sw_check(struct m0_cm_cp *cp)
Definition: net.c:541
bool sc_is_acc
Definition: cp.h:57
M0_INTERNAL uint64_t cp_home_loc_helper(const struct m0_cm_cp *cp)
Definition: cp.c:80
struct m0_pdclust_src_addr src
Definition: fd.c:108
struct m0_fol_frag sc_fol_frag
Definition: cp.h:83
M0_INTERNAL int m0_sns_cm_cp_fini(struct m0_cm_cp *cp)
Definition: cp.c:352
M0_INTERNAL int m0_sns_cm_cp_next_phase_get(int phase, struct m0_cm_cp *cp)
Definition: cp.c:274