Motr  M0
Parity Math Component
Collaboration diagram for Parity Math Component:

Modules

 Incremental recovery APIs
 

Data Structures

struct  m0_sns_ir_block
 
struct  m0_reed_solomon
 
struct  m0_parity_math
 
struct  m0_sns_ir
 

Enumerations

enum  m0_parity_cal_algo { M0_PARITY_CAL_ALGO_XOR, M0_PARITY_CAL_ALGO_REED_SOLOMON, M0_PARITY_CAL_ALGO_NR }
 
enum  m0_sns_ir_block_status { M0_SI_BLOCK_ALIVE, M0_SI_BLOCK_FAILED }
 
enum  m0_sns_ir_block_type { M0_SI_BLOCK_LOCAL, M0_SI_BLOCK_REMOTE }
 
enum  m0_parity_linsys_algo { M0_LA_GAUSSIAN, M0_LA_INVERSE }
 

Functions

M0_INTERNAL int m0_parity_math_init (struct m0_parity_math *math, uint32_t data_count, uint32_t parity_count)
 
M0_INTERNAL void m0_parity_math_fini (struct m0_parity_math *math)
 
M0_INTERNAL void m0_parity_math_calculate (struct m0_parity_math *math, struct m0_buf *data, struct m0_buf *parity)
 
M0_INTERNAL int m0_parity_math_diff (struct m0_parity_math *math, struct m0_buf *old_ver, struct m0_buf *new_ver, struct m0_buf *parity, uint32_t index)
 
M0_INTERNAL void m0_parity_math_refine (struct m0_parity_math *math, struct m0_buf *data, struct m0_buf *parity, uint32_t data_ind_changed)
 
M0_INTERNAL int m0_parity_math_recover (struct m0_parity_math *math, struct m0_buf *data, struct m0_buf *parity, struct m0_buf *fails, enum m0_parity_linsys_algo algo)
 
M0_INTERNAL void m0_parity_math_fail_index_recover (struct m0_parity_math *math, struct m0_buf *data, struct m0_buf *parity, const uint32_t failure_index)
 
M0_INTERNAL void m0_parity_math_buffer_xor (struct m0_buf *dest, const struct m0_buf *src)
 

Detailed Description

A parity math component is a part of Motr core and serving several purposes:

Enumeration Type Documentation

◆ m0_parity_cal_algo

Parity calculation type indicating various algorithms of parity calculation.

Enumerator
M0_PARITY_CAL_ALGO_XOR 
M0_PARITY_CAL_ALGO_REED_SOLOMON 
M0_PARITY_CAL_ALGO_NR 

Definition at line 49 of file parity_math.h.

◆ m0_parity_linsys_algo

Enumerator
M0_LA_GAUSSIAN 
M0_LA_INVERSE 

Definition at line 65 of file parity_math.h.

◆ m0_sns_ir_block_status

Enumerator
M0_SI_BLOCK_ALIVE 
M0_SI_BLOCK_FAILED 

Definition at line 55 of file parity_math.h.

◆ m0_sns_ir_block_type

Enumerator
M0_SI_BLOCK_LOCAL 
M0_SI_BLOCK_REMOTE 

Definition at line 60 of file parity_math.h.

Function Documentation

◆ m0_parity_math_buffer_xor()

M0_INTERNAL void m0_parity_math_buffer_xor ( struct m0_buf dest,
const struct m0_buf src 
)

XORs the source and destination buffers and stores the output in destination buffer.

Parameters
dest- destination buffer, treated as uint8_t block with b_nob elements, containing the output of src XOR dest.
src- source buffer, treated as uint8_t block with b_nob elements.

Definition at line 415 of file parity_math.c.

Here is the caller graph for this function:

◆ m0_parity_math_calculate()

M0_INTERNAL void m0_parity_math_calculate ( struct m0_parity_math math,
struct m0_buf data,
struct m0_buf parity 
)

Calculates parity block data.

Parameters
[in]data- data block, treated as uint8_t block with b_nob elements.
[out]parity- parity block, treated as uint8_t block with b_nob elements.
Precondition
m0_parity_math_init() succeeded.

Definition at line 362 of file parity_math.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_parity_math_diff()

M0_INTERNAL int m0_parity_math_diff ( struct m0_parity_math math,
struct m0_buf old_ver,
struct m0_buf new_ver,
struct m0_buf parity,
uint32_t  index 
)

Calculates parity in a differential manner.

Precondition
math != NULL && old_ver != NULL && new_ver != NULL && parity != NULL && index < math->pmi_parity_count
Parameters
old_verOld version of data block.
new_verNew version of data block.
parityParity block.
indexIndex of data unit in parity group for which old and new versions are sent.

Definition at line 371 of file parity_math.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_parity_math_fail_index_recover()

M0_INTERNAL void m0_parity_math_fail_index_recover ( struct m0_parity_math math,
struct m0_buf data,
struct m0_buf parity,
const uint32_t  failure_index 
)

Recovers data or parity units partially or fully depending on the parity calculation algorithm, given the failure index.

Parameters
math- math context.
data- data block, treated as uint8_t block with b_nob elements.
parity- parity block, treated as uint8_t block with b_nob elements.
failure_index- Index of the failed block.
Precondition
m0_parity_math_init() succeeded.

Definition at line 396 of file parity_math.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_parity_math_fini()

M0_INTERNAL void m0_parity_math_fini ( struct m0_parity_math math)

Deinitialization of parity math algorithms. Frees all memory blocks allocated by m0_parity_math_init().

Definition at line 325 of file parity_math.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_parity_math_init()

M0_INTERNAL int m0_parity_math_init ( struct m0_parity_math math,
uint32_t  data_count,
uint32_t  parity_count 
)

Initialization of parity math algorithms. Fills '*math' with appropriate values.

Parameters
data_count- count of SNS data units used in system.
parity_count- count of SNS parity units used in system.

Definition at line 333 of file parity_math.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_parity_math_recover()

M0_INTERNAL int m0_parity_math_recover ( struct m0_parity_math math,
struct m0_buf data,
struct m0_buf parity,
struct m0_buf fails,
enum m0_parity_linsys_algo  algo 
)

Recovers data units' data words from single or multiple errors. If parity also needs to be recovered, user of the function needs to place a separate call for m0_parity_math_calculate().

Parameters
[in,out]data- data block, treated as uint8_t block with b_nob elements.
[in,out]parity- parity block, treated as uint8_t block with b_nob elements.
[in]fails- block with flags, treated as uint8_t block with b_nob elements, if element is '1' then data or parity block with given index is treated as broken.
[in]algo- algorithm for recovery of data in case reed solomon encoding is used.
Precondition
m0_parity_math_init() succeeded.

Definition at line 383 of file parity_math.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ m0_parity_math_refine()

M0_INTERNAL void m0_parity_math_refine ( struct m0_parity_math math,
struct m0_buf data,
struct m0_buf parity,
uint32_t  data_ind_changed 
)

Parity block refinement iff one data word of one data unit had changed.

Parameters
[in]data- data block, treated as uint8_t block with b_nob elements.
[out]parity- parity block, treated as uint8_t block with b_nob elements.
[in]data_ind_changed- index of data unit recently changed.
Precondition
m0_parity_math_init() succeeded.

Definition at line 406 of file parity_math.c.

Here is the call graph for this function: