Motr  M0
tx_group_format.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 
24 #pragma once
25 
26 #ifndef __MOTR_BE_TX_GROUP_ONDISK_H__
27 #define __MOTR_BE_TX_GROUP_ONDISK_H__
28 
29 #include "be/io.h" /* m0_be_io */
30 #include "be/tx_regmap.h" /* m0_be_reg_area */
31 #include "be/fmt.h" /* m0_be_fmt_group */
32 #include "be/log.h" /* m0_be_log_io */
33 #include "be/tx_credit.h" /* m0_be_tx_credit */
34 
80 struct m0_be_tx_group;
81 struct m0_be_log;
82 
84  (struct m0_be_reg_area *ra,
85  struct m0_be_reg_area *ra_new,
86  void *param);
87 
88 enum {
100 };
101 
106  struct m0_be_pd *gfc_pd;
107 };
108 
112 
117 
121 
124  struct m0_ext gft_ext;
133 };
134 
135 M0_INTERNAL int m0_be_group_format_init(struct m0_be_group_format *gft,
136  struct m0_be_group_format_cfg *gft_cfg,
137  struct m0_be_tx_group *group,
138  struct m0_be_log *log);
139 M0_INTERNAL void m0_be_group_format_fini(struct m0_be_group_format *gft);
140 M0_INTERNAL bool m0_be_group_format__invariant(struct m0_be_group_format *go);
141 
142 M0_INTERNAL void m0_be_group_format_reset(struct m0_be_group_format *gft);
143 
144 M0_INTERNAL int m0_be_group_format_allocate(struct m0_be_group_format *gft);
145 M0_INTERNAL void m0_be_group_format_deallocate(struct m0_be_group_format *gft);
146 
147 M0_INTERNAL void
149  struct m0_be_group_format_cfg *gft_cfg);
150 
151 M0_INTERNAL void m0_be_group_format_prepare(struct m0_be_group_format *gft,
152  struct m0_be_op *op);
153 M0_INTERNAL void m0_be_group_format_encode(struct m0_be_group_format *gft);
154 M0_INTERNAL int m0_be_group_format_decode(struct m0_be_group_format *gft);
155 
156 M0_INTERNAL void m0_be_group_format_reg_log_add(struct m0_be_group_format *gft,
157  const struct m0_be_reg_d *rd);
158 M0_INTERNAL void m0_be_group_format_reg_seg_add(struct m0_be_group_format *gft,
159  const struct m0_be_reg_d *rd);
160 M0_INTERNAL uint32_t
162 M0_INTERNAL void
164  uint32_t index,
165  struct m0_be_reg_d *rd);
166 
167 M0_INTERNAL void m0_be_group_format_tx_add(struct m0_be_group_format *gft,
168  struct m0_be_fmt_tx *ftx);
169 M0_INTERNAL uint32_t
171 M0_INTERNAL void
173  uint32_t index,
174  struct m0_be_fmt_tx *ftx);
175 
176 M0_INTERNAL struct m0_be_fmt_group_info *
178 
179 /* static method */
180 M0_INTERNAL m0_bcount_t
182  struct m0_be_tx_credit *cred,
183  m0_bcount_t cred_payload);
184 M0_INTERNAL void
186  m0_bcount_t size_reserved);
187 
189 M0_INTERNAL m0_bindex_t
191 
193 M0_INTERNAL m0_bindex_t
195 
196 M0_INTERNAL void
198  struct m0_be_log *log);
199 
200 M0_INTERNAL void m0_be_group_format_log_write(struct m0_be_group_format *gft,
201  struct m0_be_op *op);
202 M0_INTERNAL void m0_be_group_format_log_read(struct m0_be_group_format *gft,
203  struct m0_be_op *op);
204 
205 M0_INTERNAL void
207 M0_INTERNAL void m0_be_group_format_seg_place(struct m0_be_group_format *gft,
208  struct m0_be_op *op);
209 
210 /* move to engine? */
211 M0_INTERNAL void m0_be_group_format_discard(struct m0_be_log_discard *ld,
212  struct m0_be_log_discard_item *ldi);
213 
214 
215 M0_INTERNAL void
217  struct m0_be_io_credit *io_cred);
218 
221 #endif /* __MOTR_BE_TX_GROUP_ONDISK_H__ */
222 
223 /*
224  * Local variables:
225  * c-indentation-style: "K&R"
226  * c-basic-offset: 8
227  * tab-width: 8
228  * fill-column: 80
229  * scroll-step: 1
230  * End:
231  */
232 /*
233  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
234  */
struct m0_be_log_record gft_log_record
struct m0_be_group_format_cfg gft_cfg
M0_INTERNAL void m0_be_group_format_prepare(struct m0_be_group_format *gft, struct m0_be_op *op)
struct m0_be_fmt_cblock gft_fmt_cblock
M0_INTERNAL void m0_be_group_format_log_read(struct m0_be_group_format *gft, struct m0_be_op *op)
struct m0_be_log_record_iter gft_log_record_iter
M0_INTERNAL void m0_be_group_format_seg_io_credit(struct m0_be_group_format_cfg *gft_cfg, struct m0_be_io_credit *io_cred)
struct m0_be_fmt_group * gft_fmt_group_decoded
struct m0_be_log * gfc_log
M0_INTERNAL m0_bindex_t m0_be_group_format_log_discarded(const struct m0_be_group_format *gft)
M0_INTERNAL void m0_be_group_format_reg_get(const struct m0_be_group_format *gft, uint32_t index, struct m0_be_reg_d *rd)
M0_INTERNAL void m0_be_group_format_recovery_prepare(struct m0_be_group_format *gft, struct m0_be_log *log)
M0_INTERNAL void m0_be_group_format_reset(struct m0_be_group_format *gft)
struct m0_be_pd * gfc_pd
M0_INTERNAL void m0_be_group_format_encode(struct m0_be_group_format *gft)
uint64_t m0_bindex_t
Definition: types.h:80
M0_INTERNAL int m0_be_group_format_allocate(struct m0_be_group_format *gft)
uint64_t m0_bcount_t
Definition: types.h:77
M0_INTERNAL void m0_be_group_format_discard(struct m0_be_log_discard *ld, struct m0_be_log_discard_item *ldi)
op
Definition: libdemo.c:64
struct m0_be_op gft_log_discard_get
M0_INTERNAL void m0_be_group_format_reg_seg_add(struct m0_be_group_format *gft, const struct m0_be_reg_d *rd)
M0_INTERNAL uint32_t m0_be_group_format_reg_nr(const struct m0_be_group_format *gft)
M0_INTERNAL void m0_be_group_format_module_setup(struct m0_be_group_format *gft, struct m0_be_group_format_cfg *gft_cfg)
struct m0_be_fmt_group_cfg gfc_fmt_cfg
struct m0_be_log_discard * gfc_log_discard
M0_INTERNAL void m0_be_group_format_seg_place(struct m0_be_group_format *gft, struct m0_be_op *op)
M0_INTERNAL void m0_be_group_format_log_write(struct m0_be_group_format *gft, struct m0_be_op *op)
struct m0_be_op gft_pd_io_get
M0_INTERNAL void m0_be_group_format_tx_add(struct m0_be_group_format *gft, struct m0_be_fmt_tx *ftx)
M0_INTERNAL void m0_be_group_format_log_use(struct m0_be_group_format *gft, m0_bcount_t size_reserved)
struct m0_be_op gft_all_get
M0_INTERNAL void m0_be_group_format_reg_log_add(struct m0_be_group_format *gft, const struct m0_be_reg_d *rd)
struct m0_be_fmt_group gft_fmt_group
static void group(void)
Definition: sm.c:386
M0_INTERNAL int m0_be_group_format_init(struct m0_be_group_format *gft, struct m0_be_group_format_cfg *gft_cfg, struct m0_be_tx_group *group, struct m0_be_log *log)
struct m0_be_fmt_cblock * gft_fmt_cblock_decoded
M0_INTERNAL m0_bindex_t m0_be_group_format_log_position(const struct m0_be_group_format *gft)
M0_INTERNAL void m0_be_group_format_deallocate(struct m0_be_group_format *gft)
M0_INTERNAL void m0_be_group_format_seg_place_prepare(struct m0_be_group_format *gft)
M0_INTERNAL void m0_be_group_format_fini(struct m0_be_group_format *gft)
M0_INTERNAL uint32_t m0_be_group_format_tx_nr(const struct m0_be_group_format *gft)
Definition: ext.h:37
struct m0_be_pd_io * gft_pd_io
struct m0_ext gft_ext
Definition: pd.h:64
M0_INTERNAL m0_bcount_t m0_be_group_format_log_reserved_size(struct m0_be_log *log, struct m0_be_tx_credit *cred, m0_bcount_t cred_payload)
struct m0_be_op gft_pd_io_op
struct m0_be_log * gft_log
M0_INTERNAL bool m0_be_group_format__invariant(struct m0_be_group_format *go)
M0_INTERNAL int m0_be_group_format_decode(struct m0_be_group_format *gft)
void(* m0_be_group_format_reg_area_rebuild_t)(struct m0_be_reg_area *ra, struct m0_be_reg_area *ra_new, void *param)
Definition: log.h:261
struct m0_module gft_module
Definition: pd.c:49
Definition: op.h:74
M0_INTERNAL struct m0_be_fmt_group_info * m0_be_group_format_group_info(struct m0_be_group_format *gft)
struct m0_be_log_discard_item * gft_log_discard_item
struct m0_be_op gft_tmp_op
M0_INTERNAL void m0_be_group_format_tx_get(const struct m0_be_group_format *gft, uint32_t index, struct m0_be_fmt_tx *ftx)