Motr  M0
dtm0_log.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2021 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 #pragma once
23 #ifndef __MOTR_BE_DTM0_LOG_H__
24 #define __MOTR_BE_DTM0_LOG_H__
25 
26 #include "be/list.h" /* m0_be_list */
27 #include "dtm0/tx_desc.h" /* m0_dtm0_tx_desc */
28 #include "fid/fid.h" /* m0_fid */
29 #include "lib/buf.h" /* m0_buf */
30 #include "dtm0/dtx.h" /* struct m0_dtm0_dtx */
31 
32 struct m0_be_tx;
33 struct m0_be_tx_credit;
34 struct m0_dtm0_clk_src;
35 
148 };
149 
163  uint64_t dlr_magic;
164  union {
166  * used when this record is
167  * stored within a persistent
168  * log that is going to stored
169  * in BE.
170  */
171  struct m0_tlink dlr_tlink; /*
172  * used when this record is
173  * stored within a volatile
174  * log that is going to stored
175  * in memory.
176  */
177  } u;
179 };
180 
199  struct m0_be_seg *dl_seg;
202  union {
206  struct m0_tl *dl_inmem;
207  } u;
208 };
209 
237 M0_INTERNAL int m0_be_dtm0_log_alloc(struct m0_be_dtm0_log **log);
238 
255 M0_INTERNAL int m0_be_dtm0_log_init(struct m0_be_dtm0_log *log,
256  struct m0_be_seg *seg,
257  struct m0_dtm0_clk_src *cs,
258  bool is_plog);
259 
272 M0_INTERNAL void m0_be_dtm0_log_fini(struct m0_be_dtm0_log *log);
273 
284 M0_INTERNAL void m0_be_dtm0_log_free(struct m0_be_dtm0_log **log);
285 
308  struct m0_dtm0_tx_desc *txd,
309  struct m0_buf *payload,
310  struct m0_be_seg *seg,
311  struct m0_dtm0_log_rec *rec,
312  struct m0_be_tx_credit *accum);
313 
327 M0_INTERNAL int m0_be_dtm0_log_create(struct m0_be_tx *tx,
328  struct m0_be_seg *seg,
329  struct m0_be_dtm0_log **out);
330 
342 M0_INTERNAL void m0_be_dtm0_log_destroy(struct m0_be_tx *tx,
343  struct m0_be_dtm0_log **log);
344 
363 M0_INTERNAL int m0_be_dtm0_log_update(struct m0_be_dtm0_log *log,
364  struct m0_be_tx *tx,
365  struct m0_dtm0_tx_desc *txd,
366  struct m0_buf *payload);
367 
384 M0_INTERNAL
386  const struct m0_dtm0_tid *id);
387 
407 M0_INTERNAL int m0_be_dtm0_log_prune(struct m0_be_dtm0_log *log,
408  struct m0_be_tx *tx,
409  const struct m0_dtm0_tid *id);
410 
433 M0_INTERNAL bool m0_be_dtm0_plog_can_prune(struct m0_be_dtm0_log *log,
434  const struct m0_dtm0_tid *id,
435  struct m0_be_tx_credit *cred);
436 
456 M0_INTERNAL int m0_be_dtm0_plog_prune(struct m0_be_dtm0_log *log,
457  struct m0_be_tx *tx,
458  const struct m0_dtm0_tid *id);
459 
475 M0_INTERNAL void m0_be_dtm0_log_clear(struct m0_be_dtm0_log *log);
476 
489 M0_INTERNAL int m0_be_dtm0_volatile_log_insert(struct m0_be_dtm0_log *log,
490  struct m0_dtm0_log_rec *rec);
491 
503 M0_INTERNAL void m0_be_dtm0_volatile_log_update(struct m0_be_dtm0_log *log,
504  struct m0_dtm0_log_rec *rec);
505 
519 M0_INTERNAL void m0_be_dtm0_log_pmsg_post(struct m0_be_dtm0_log *log,
520  struct m0_fop *fop);
521  /* end DTM0Internals */
523 
524 #endif /* __MOTR_BE_DTM0_LOG_H__ */
525 
526 /*
527  * Local variables:
528  * c-indentation-style: "K&R"
529  * c-basic-offset: 8
530  * tab-width: 8
531  * fill-column: 80
532  * scroll-step: 1
533  * End:
534  */
535 /*
536  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
537  */
M0_INTERNAL bool m0_be_dtm0_plog_can_prune(struct m0_be_dtm0_log *log, const struct m0_dtm0_tid *id, struct m0_be_tx_credit *cred)
Definition: dtm0_log.c:573
M0_INTERNAL void m0_be_dtm0_log_free(struct m0_be_dtm0_log **log)
Definition: dtm0_log.c:119
struct m0_dtm0_dtx dlr_dtx
Definition: dtm0_log.h:161
struct m0_tl * dl_inmem
Definition: dtm0_log.h:206
struct m0_dtm0_tx_desc dlr_txd
Definition: dtm0_log.h:162
struct m0_be_seg * dl_seg
Definition: dtm0_log.h:199
M0_INTERNAL void m0_be_dtm0_log_fini(struct m0_be_dtm0_log *log)
Definition: dtm0_log.c:111
M0_INTERNAL void m0_be_dtm0_volatile_log_update(struct m0_be_dtm0_log *log, struct m0_dtm0_log_rec *rec)
Definition: dtm0_log.c:555
struct m0_be_list_link dlr_link
Definition: dtm0_log.h:165
M0_INTERNAL int m0_be_dtm0_plog_prune(struct m0_be_dtm0_log *log, struct m0_be_tx *tx, const struct m0_dtm0_tid *id)
Definition: dtm0_log.c:609
struct m0_buf dlr_payload
Definition: dtm0_log.h:178
M0_INTERNAL void m0_be_dtm0_log_clear(struct m0_be_dtm0_log *log)
Definition: dtm0_log.c:520
op
Definition: libdemo.c:64
Definition: buf.h:37
struct m0_be_list * dl_persist
Definition: dtm0_log.h:204
M0_INTERNAL int m0_be_dtm0_volatile_log_insert(struct m0_be_dtm0_log *log, struct m0_dtm0_log_rec *rec)
Definition: dtm0_log.c:540
M0_INTERNAL int m0_be_dtm0_log_init(struct m0_be_dtm0_log *log, struct m0_be_seg *seg, struct m0_dtm0_clk_src *cs, bool is_plog)
Definition: dtm0_log.c:94
M0_INTERNAL int m0_be_dtm0_log_create(struct m0_be_tx *tx, struct m0_be_seg *seg, struct m0_be_dtm0_log **out)
Definition: dtm0_log.c:237
M0_INTERNAL int m0_be_dtm0_log_alloc(struct m0_be_dtm0_log **log)
Definition: dtm0_log.c:70
M0_INTERNAL void m0_be_dtm0_log_pmsg_post(struct m0_be_dtm0_log *log, struct m0_fop *fop)
Definition: dtm0_log.c:637
union m0_dtm0_log_rec::@30 u
union m0_be_dtm0_log::@31 u
Definition: tlist.h:251
uint64_t dlr_magic
Definition: dtm0_log.h:163
M0_INTERNAL void m0_be_dtm0_log_destroy(struct m0_be_tx *tx, struct m0_be_dtm0_log **log)
Definition: dtm0_log.c:260
m0_be_dtm0_log_credit_op
Definition: dtm0_log.h:141
M0_INTERNAL int m0_be_dtm0_log_prune(struct m0_be_dtm0_log *log, struct m0_be_tx *tx, const struct m0_dtm0_tid *id)
Definition: dtm0_log.c:477
struct m0_tlink dlr_tlink
Definition: dtm0_log.h:171
Definition: seg.h:66
M0_INTERNAL int m0_be_dtm0_log_update(struct m0_be_dtm0_log *log, struct m0_be_tx *tx, struct m0_dtm0_tx_desc *txd, struct m0_buf *payload)
Definition: dtm0_log.c:460
M0_INTERNAL void m0_be_dtm0_log_credit(enum m0_be_dtm0_log_credit_op op, struct m0_dtm0_tx_desc *txd, struct m0_buf *payload, struct m0_be_seg *seg, struct m0_dtm0_log_rec *rec, struct m0_be_tx_credit *accum)
Definition: dtm0_log.c:202
static struct m0_fop * fop
Definition: item.c:57
struct m0_dtm0_clk_src * dl_cs
Definition: dtm0_log.h:201
static struct m0_be_seg * seg
Definition: btree.c:40
bool dl_is_persistent
Definition: dtm0_log.h:194
M0_INTERNAL struct m0_dtm0_log_rec * m0_be_dtm0_log_find(struct m0_be_dtm0_log *log, const struct m0_dtm0_tid *id)
Definition: dtm0_log.c:270
#define out(...)
Definition: gen.c:41
struct m0_mutex dl_lock
Definition: dtm0_log.h:198
Definition: mutex.h:47
Definition: fop.h:79
const uint64_t payload[]
Definition: base.c:65
Definition: tx.h:280