|
| M0_TL_DESCR_DEFINE (m0_rec_frag, "fol record fragment", M0_INTERNAL, struct m0_fol_frag, rp_link, rp_magic, M0_FOL_FRAG_LINK_MAGIC, M0_FOL_FRAG_HEAD_MAGIC) |
|
| M0_TL_DEFINE (m0_rec_frag, M0_INTERNAL, struct m0_fol_frag) |
|
static size_t | fol_rec_header_pack_size (struct m0_fol_rec_header *h) |
|
M0_INTERNAL void | m0_fol_init (struct m0_fol *fol) |
|
M0_INTERNAL void | m0_fol_fini (struct m0_fol *fol) |
|
M0_INTERNAL void | m0_fol_rec_init (struct m0_fol_rec *rec, struct m0_fol *fol) |
|
M0_INTERNAL void | m0_fol_rec_fini (struct m0_fol_rec *rec) |
|
M0_INTERNAL bool | m0_fol_rec_invariant (const struct m0_fol_rec *rec) |
|
M0_INTERNAL void | m0_fol_frag_init (struct m0_fol_frag *frag, void *data, const struct m0_fol_frag_type *type) |
|
M0_INTERNAL void | m0_fol_frag_fini (struct m0_fol_frag *frag) |
|
M0_INTERNAL int | m0_fols_init (void) |
|
M0_INTERNAL void | m0_fols_fini (void) |
|
M0_INTERNAL int | m0_fol_frag_type_register (struct m0_fol_frag_type *type) |
|
M0_INTERNAL void | m0_fol_frag_type_deregister (struct m0_fol_frag_type *type) |
|
static const struct m0_fol_frag_type * | fol_frag_type_lookup (uint32_t index) |
|
static size_t | fol_record_pack_size (struct m0_fol_rec *rec) |
|
static int | fol_rec_encdec (struct m0_fol_rec *rec, struct m0_bufvec_cursor *cur, enum m0_xcode_what what) |
|
static int | fol_record_pack (struct m0_fol_rec *rec, struct m0_buf *buf) |
|
M0_INTERNAL int | m0_fol_rec_encode (struct m0_fol_rec *rec, struct m0_buf *at) |
|
M0_INTERNAL int | m0_fol_rec_decode (struct m0_fol_rec *rec, struct m0_buf *at) |
|
int | m0_fol_rec_to_str (struct m0_fol_rec *rec, char *str, int str_len) |
|
M0_INTERNAL void | m0_fol_frag_add (struct m0_fol_rec *rec, struct m0_fol_frag *frag) |
|
| M0_BASSERT (M0_IS_8ALIGNED(sizeof(struct m0_fol_rec_header))) |
|
| M0_TL_DESCR_DECLARE (m0_rec_frag, M0_EXTERN) |
|
| M0_TL_DECLARE (m0_rec_frag, M0_INTERNAL, struct m0_fol_frag) |
|
File operations log (fol) is a per-node collection of records, describing updates to file system state carried out on the node. See HLD for the description of requirements, usage patterns and constraints on fol, as well as important terminology (update, operation, etc.):
For documentation links, please refer to this file : doc/motr-design-doc-list.rst
A fol is represented by an instance of struct m0_fol. A fol record is represented by the m0_fol_rec data type.
A fol record contains the list of fol record fragments, belonging to fol record fragment types, added during updates. These fol record fragments provide flexibility for modules to participate in a transaction without global knowledge.
- See also
- m0_fol_frag : FOL record fragment.
-
m0_fol_frag_type : FOL record fragment type.
m0_fol_frag_ops structure contains operations for undo and redo of FOL record fragments.
- See also
- m0_fol_frag_init() : Initializes m0_fol_frag with m0_fol_frag_type_ops.
-
m0_fol_frag_fini() : Finalizes FOL record fragment.
-
m0_fol_frag_type_register() : Registers FOL record fragment type.
-
m0_fol_frag_type_deregister() : Deregisters FOL record fragment type.
FOL record fragments list is kept in m0_fol_rec::fr_frags which is initialized in m0_fol_rec_init().
m0_fol_rec_encode() is used to compose FOL record from FOL record descriptor and fragments. It encodes the FOL record fragments in the list m0_fol_rec:fr_frags in a buffer, which then will be added into the BE log.
- See also
- m0_fol_rec_encode()
-
m0_fol_rec_decode()
m0_fol_frag_type_init() and m0_fol_frag_type_fini() are added to initialize and finalize FOL fragment types. FOL record fragment types are registered in a global array of FOL record fragments using m0_fol_frag_type::rpt_index.
After successful execution of updates on server side, in FOM generic phase using m0_fom_fol_rec_encode() FOL record fragments in the list are combined in a FOL record and is made persistent. Before this phase all FOL record fragments need to be added in the list after completing their updates.
After retrieving FOL record from the storage, FOL record fragments are decoded based on fragment type using index and are used in undo or redo operations.
Implementation notes.
FOL stores its records in BE log at transaction payloads and identifies them by transaction id.
- struct m0_fol_rec_header
- followed by rh_frags_nr m0_fol_frag-s
- followed by rh_data_len bytes
- followed by the list of fol record fragments.
When a record is fetched from the fol, it is decoded by m0_fol_rec_decode(). When a record is placed into the fol, its representation is prepared by m0_fol_rec_encode().
◆ FRAG_HEADER_XCODE_OBJ
Definition at line 64 of file fol.c.
◆ FRAG_XCODE_OBJ
#define FRAG_XCODE_OBJ |
( |
|
r | ) |
|
Value: .xo_type = frag->rp_ops !=
NULL ? \
frag->rp_ops->rpo_type->rpt_xt : \
m0_fop_fol_frag_type.rpt_xt, \
}
Definition at line 67 of file fol.c.
◆ M0_FOL_FRAG_TYPE_DECLARE
#define M0_FOL_FRAG_TYPE_DECLARE |
( |
|
frag, |
|
|
|
scope, |
|
|
|
undo, |
|
|
|
redo, |
|
|
|
undo_cred, |
|
|
|
redo_cred |
|
) |
| |
Value: .rpo_undo = undo, \
.rpo_redo = redo, \
.rpo_undo_credit = undo_cred, \
.rpo_redo_credit = redo_cred, \
}; \
static
void frag ## _ops_init(
struct m0_fol_frag *frag) \
{ \
frag->rp_ops = &frag ## _ops; \
} \
};
const struct m0_fol_frag_type * rpo_type
void(* rpto_rec_frag_init)(struct m0_fol_frag *frag)
Definition at line 324 of file fol.h.
◆ M0_FOL_FRAG_TYPE_INIT
#define M0_FOL_FRAG_TYPE_INIT |
( |
|
frag, |
|
|
|
name |
|
) |
| |
Value: &frag ## _type_ops)
#define M0_FOL_FRAG_TYPE_XC_OPS(name, frag_xc, frag_type_ops)
Definition at line 349 of file fol.h.
◆ M0_FOL_FRAG_TYPE_XC_OPS
#define M0_FOL_FRAG_TYPE_XC_OPS |
( |
|
name, |
|
|
|
frag_xc, |
|
|
|
frag_type_ops |
|
) |
| |
Value: .rpt_xt = (frag_xc), \
};
const struct m0_fol_frag_type_ops * rpt_ops
Definition at line 342 of file fol.h.
◆ anonymous enum
Enumerator |
---|
FOL_FRAG_TYPE_MAX | |
PART_TYPE_START_INDEX | |
Definition at line 158 of file fol.c.
◆ anonymous enum
Enumerator |
---|
FOL_REC_MAXSIZE | |
Definition at line 108 of file fol.h.
◆ fol_frag_type_lookup()
◆ fol_rec_encdec()
◆ fol_rec_header_pack_size()
◆ fol_record_pack()
◆ fol_record_pack_size()
static size_t fol_record_pack_size |
( |
struct m0_fol_rec * |
rec | ) |
|
|
static |
◆ M0_BASSERT()
◆ m0_fol_fini()
M0_INTERNAL void m0_fol_fini |
( |
struct m0_fol * |
fol | ) |
|
Definition at line 89 of file fol.c.
◆ m0_fol_frag_add()
◆ m0_fol_frag_fini()
M0_INTERNAL void m0_fol_frag_fini |
( |
struct m0_fol_frag * |
frag | ) |
|
◆ m0_fol_frag_init()
During encoding of FOL record data points to the in-memory FOL record fragment object allocated by the calling function. In case if decoding data should be NULL, as it is allocated by xcode.
- Precondition
- frag != NULL
-
type != NULL
Definition at line 121 of file fol.c.
◆ m0_fol_frag_type_deregister()
◆ m0_fol_frag_type_register()
Register a new fol record fragment type.
Definition at line 178 of file fol.c.
◆ m0_fol_init()
M0_INTERNAL void m0_fol_init |
( |
struct m0_fol * |
fol | ) |
|
Initialise in-memory fol structure.
Definition at line 84 of file fol.c.
◆ m0_fol_rec_decode()
M0_INTERNAL int m0_fol_rec_decode |
( |
struct m0_fol_rec * |
rec, |
|
|
struct m0_buf * |
at |
|
) |
| |
◆ m0_fol_rec_encode()
M0_INTERNAL int m0_fol_rec_encode |
( |
struct m0_fol_rec * |
rec, |
|
|
struct m0_buf * |
at |
|
) |
| |
Encodes the fol record at the specified buffer .
- See also
- m0_fol_rec_put()
Definition at line 314 of file fol.c.
◆ m0_fol_rec_fini()
M0_INTERNAL void m0_fol_rec_fini |
( |
struct m0_fol_rec * |
rec | ) |
|
Finalizes fol record fragments list.
Definition at line 104 of file fol.c.
◆ m0_fol_rec_init()
M0_INTERNAL void m0_fol_rec_init |
( |
struct m0_fol_rec * |
rec, |
|
|
struct m0_fol * |
fol |
|
) |
| |
Initializes fol record fragments list.
The user must call m0_fol_rec_fini() when finished dealing with the record.
Definition at line 98 of file fol.c.
◆ m0_fol_rec_invariant()
M0_INTERNAL bool m0_fol_rec_invariant |
( |
const struct m0_fol_rec * |
rec | ) |
|
◆ m0_fol_rec_to_str()
int m0_fol_rec_to_str |
( |
struct m0_fol_rec * |
rec, |
|
|
char * |
str, |
|
|
int |
str_len |
|
) |
| |
◆ m0_fols_fini()
M0_INTERNAL void m0_fols_fini |
( |
void |
| ) |
|
◆ m0_fols_init()
M0_INTERNAL int m0_fols_init |
( |
void |
| ) |
|
◆ M0_TL_DECLARE()
M0_TL_DECLARE |
( |
m0_rec_frag |
, |
|
|
M0_INTERNAL |
, |
|
|
struct m0_fol_frag |
|
|
) |
| |
◆ M0_TL_DEFINE()
M0_TL_DEFINE |
( |
m0_rec_frag |
, |
|
|
M0_INTERNAL |
, |
|
|
struct m0_fol_frag |
|
|
) |
| |
◆ M0_TL_DESCR_DECLARE()
M0_TL_DESCR_DECLARE |
( |
m0_rec_frag |
, |
|
|
M0_EXTERN |
|
|
) |
| |
Descriptor for the tlist of fol record fragments.
◆ M0_TL_DESCR_DEFINE()
◆ rptypes
◆ rptypes_lock