Motr  M0
io_pargrp.c File Reference
#include "motr/client.h"
#include "motr/client_internal.h"
#include "motr/addb.h"
#include "motr/pg.h"
#include "motr/io.h"
#include "lib/buf.h"
#include "lib/memory.h"
#include "lib/errno.h"
#include "fid/fid.h"
#include "rm/rm.h"
#include "sns/parity_repair.h"
#include "fd/fd.h"
#include "lib/trace.h"
Include dependency graph for io_pargrp.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT
 

Functions

 M0_BOB_DEFINE (M0_INTERNAL, &pgiomap_bobtype, pargrp_iomap)
 
 M0_BOB_DEFINE (M0_INTERNAL, &dtbuf_bobtype, data_buf)
 
static void pargrp_src_addr (m0_bindex_t index, const struct m0_op_io *ioo, const struct target_ioreq *tio_req, struct m0_pdclust_src_addr *src)
 
M0_INTERNAL uint64_t pargrp_id_find (m0_bindex_t index, const struct m0_op_io *ioo, const struct ioreq_fop *ir_fop)
 
static m0_bindex_t gobj_offset (m0_bindex_t toff, struct pargrp_iomap *map, struct m0_pdclust_layout *play, struct m0_pdclust_src_addr *src)
 
static bool is_page_read (struct data_buf *dbuf)
 
M0_INTERNAL bool data_buf_invariant (const struct data_buf *db)
 
static bool data_buf_invariant_nr (const struct pargrp_iomap *map)
 
M0_INTERNAL bool pargrp_iomap_invariant (const struct pargrp_iomap *map)
 
M0_INTERNAL bool pargrp_iomap_invariant_nr (const struct m0_op_io *ioo)
 
static void data_buf_init (struct data_buf *buf, void *addr, uint64_t addr_size, uint64_t flags)
 
static void data_buf_fini (struct data_buf *buf)
 
static void data_buf_dealloc_fini (struct data_buf *buf)
 
static struct data_bufdata_buf_alloc_init (struct m0_obj *obj, enum page_attr pattr)
 
static struct data_bufdata_buf_replicate_init (struct pargrp_iomap *map, int row, enum page_attr pattr)
 
static m0_bindex_t seg_set (struct pargrp_iomap *map, uint32_t seg, struct m0_ivec_cursor *cur, m0_bindex_t grpend)
 
static void seg_idx_inc_round (struct pargrp_iomap *map, uint32_t seg, uint64_t sz)
 
static void seg_align (struct pargrp_iomap *map, uint32_t seg, m0_bindex_t end, uint64_t sz)
 
static int pargrp_iomap_populate_pi_ivec (struct pargrp_iomap *map, struct m0_ivec_cursor *cursor, struct m0_bufvec_cursor *buf_cursor, bool rmw)
 
static int pargrp_iomap_select_ro_rr (struct pargrp_iomap *map, m0_bcount_t data_pages_nr, m0_bcount_t parity_pages_nr)
 
static int pargrp_iomap_populate (struct pargrp_iomap *map, struct m0_ivec_cursor *cursor, struct m0_bufvec_cursor *buf_cursor)
 
static uint64_t pargrp_iomap_fullpages_count (struct pargrp_iomap *map)
 
static bool pargrp_iomap_spans_seg (struct pargrp_iomap *map, m0_bindex_t index, m0_bcount_t count)
 
static int pargrp_iomap_seg_process (struct pargrp_iomap *map, uint32_t seg, bool rmw, uint64_t skip_buf_index, struct m0_bufvec_cursor *buf_cursor)
 
static int pargrp_iomap_databuf_alloc (struct pargrp_iomap *map, uint32_t row, uint32_t col, struct m0_bufvec_cursor *data)
 
static uint64_t pargrp_iomap_auxbuf_alloc (struct pargrp_iomap *map, uint32_t row, uint32_t col)
 
static int pargrp_iomap_readold_auxbuf_alloc (struct pargrp_iomap *map)
 
static int pargrp_iomap_readrest (struct pargrp_iomap *map)
 
static int pargrp_iomap_parity_recalc (struct pargrp_iomap *map)
 
static int pargrp_iomap_paritybufs_alloc (struct pargrp_iomap *map)
 
static int pargrp_iomap_databuf_replicate (struct pargrp_iomap *map)
 
static int pargrp_iomap_pages_mark_as_failed (struct pargrp_iomap *map, enum m0_pdclust_unit_type type)
 
static int unit_state (const struct m0_pdclust_src_addr *src, struct m0_op_io *ioo, enum m0_pool_nd_state *state)
 
static int io_spare_map (const struct pargrp_iomap *map, const struct m0_pdclust_src_addr *src, uint32_t *spare_slot, uint32_t *spare_slot_prev, enum m0_pool_nd_state *eff_state)
 
static void mark_page_as_read_failed (struct pargrp_iomap *map, uint32_t row, uint32_t col, enum page_attr page_type)
 
static int pargrp_iomap_dgmode_process (struct pargrp_iomap *map, struct target_ioreq *tio, m0_bindex_t *index, uint32_t count)
 
static int pargrp_iomap_dgmode_postprocess (struct pargrp_iomap *map)
 
static uint32_t iomap_dgmode_recov_prepare (struct pargrp_iomap *map, uint8_t *failed)
 
static int pargrp_iomap_dgmode_recover (struct pargrp_iomap *map)
 
static bool crc_cmp (const struct m0_buf *val1, const struct m0_buf *val2)
 
static void db_crc_set (struct data_buf *dbuf, uint32_t key, struct m0_key_val *kv)
 
static size_t offset_get (struct pargrp_iomap *map)
 
static int pargrp_iomap_replica_elect (struct pargrp_iomap *map)
 
static int pargrp_iomap_parity_verify (struct pargrp_iomap *map)
 
static void pargrp_iomap_bufs_free (struct data_buf ***bufs, int nr)
 
static int pargrp_iomap_bufs_alloc (struct data_buf ****bufs_out, uint32_t row_nr, uint32_t col_nr)
 
M0_INTERNAL int pargrp_iomap_init (struct pargrp_iomap *map, struct m0_op_io *ioo, uint64_t grpid)
 
static bool are_pbufs_allocated (struct m0_op_io *ioo)
 
M0_INTERNAL void pargrp_iomap_fini (struct pargrp_iomap *map, struct m0_obj *obj)
 

Variables

const struct m0_bob_type pgiomap_bobtype
 
const struct m0_bob_type dtbuf_bobtype
 
static const struct pargrp_iomap_ops iomap_ops
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT

Definition at line 36 of file io_pargrp.c.

Function Documentation

◆ are_pbufs_allocated()

static bool are_pbufs_allocated ( struct m0_op_io ioo)
static

Definition at line 2458 of file io_pargrp.c.

Here is the caller graph for this function:

◆ crc_cmp()

static bool crc_cmp ( const struct m0_buf val1,
const struct m0_buf val2 
)
static

Definition at line 2086 of file io_pargrp.c.

Here is the caller graph for this function:

◆ data_buf_alloc_init()

static struct data_buf* data_buf_alloc_init ( struct m0_obj obj,
enum page_attr  pattr 
)
static

Initialises a data_buf descriptor, and allocate the memory. This is heavily based on m0t1fs/linux_kernel/file.cdata_buf_alloc_init

Parameters
objThe object the memory should be allocated for, use to find the block size.
pattrWhether the memory should be used for data or parity.
Returns
The allocated data_buf, or NULL.

Definition at line 323 of file io_pargrp.c.

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

◆ data_buf_dealloc_fini()

static void data_buf_dealloc_fini ( struct data_buf buf)
static

Finalises a data_buf descriptor and free the memory it describes. This is heavily based on m0t1fs/linux_kernel/file.cdata_buf_dealloc_fini

Parameters
bufThe data_buf to finalise.

Definition at line 290 of file io_pargrp.c.

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

◆ data_buf_fini()

static void data_buf_fini ( struct data_buf buf)
static

Finalises a data_buf descriptor. This is heavily based on m0t1fs/linux_kernel/file.cdata_buf_fini

Parameters
bufThe data_buf to finalise.

Definition at line 272 of file io_pargrp.c.

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

◆ data_buf_init()

static void data_buf_init ( struct data_buf buf,
void *  addr,
uint64_t  addr_size,
uint64_t  flags 
)
static

Initialises a data_buf descriptor. This is heavily based on m0t1fs/linux_kernel/file.cdata_buf_init

Parameters
buf[out]The data_buf decsriptor to initialise.
addrThe address to use for data.
addr_sizeThe size of the 'addr' memory.
flagsWhether this data/memory is for file-data or parity.

Definition at line 246 of file io_pargrp.c.

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

◆ data_buf_invariant()

M0_INTERNAL bool data_buf_invariant ( const struct data_buf db)

This is heavily based on m0t1fs/linux_kernel/file.cdata_buf_invariant

Definition at line 145 of file io_pargrp.c.

Here is the caller graph for this function:

◆ data_buf_invariant_nr()

static bool data_buf_invariant_nr ( const struct pargrp_iomap map)
static

Checks all of the data_bufs in the parity group iomap pass the invariant check. This is heavily based on m0t1fs/linux_kernel/file.cdata_buf_invariant_nr

Parameters
mapThe set of data/parity data_bufs that should be checked.
Returns
true or false.

Definition at line 160 of file io_pargrp.c.

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

◆ data_buf_replicate_init()

static struct data_buf* data_buf_replicate_init ( struct pargrp_iomap map,
int  row,
enum page_attr  pattr 
)
static

Definition at line 357 of file io_pargrp.c.

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

◆ db_crc_set()

static void db_crc_set ( struct data_buf dbuf,
uint32_t  key,
struct m0_key_val kv 
)
static

Definition at line 2091 of file io_pargrp.c.

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

◆ gobj_offset()

static m0_bindex_t gobj_offset ( m0_bindex_t  toff,
struct pargrp_iomap map,
struct m0_pdclust_layout play,
struct m0_pdclust_src_addr src 
)
inlinestatic

Definition at line 115 of file io_pargrp.c.

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

◆ io_spare_map()

static int io_spare_map ( const struct pargrp_iomap map,
const struct m0_pdclust_src_addr src,
uint32_t *  spare_slot,
uint32_t *  spare_slot_prev,
enum m0_pool_nd_state eff_state 
)
static

Gets the spare unit (used as new data unit) if SNS repair is done.

This is heavily based on m0t1fs/linux_kernel/file.cio_spare_map.

Parameters
mapThe parity map in question.
srcThe unit in question.
spare_slotCurrent spare unit.
spare_slot_prevPrevious spare unit.
eff_stateReturned state of current spare unit.
Returns
0 for success, -errno otherwise.

Definition at line 1580 of file io_pargrp.c.

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

◆ iomap_dgmode_recov_prepare()

static uint32_t iomap_dgmode_recov_prepare ( struct pargrp_iomap map,
uint8_t *  failed 
)
static

Definition at line 1949 of file io_pargrp.c.

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

◆ is_page_read()

static bool is_page_read ( struct data_buf dbuf)
inlinestatic

Definition at line 136 of file io_pargrp.c.

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

◆ M0_BOB_DEFINE() [1/2]

M0_BOB_DEFINE ( M0_INTERNAL  ,
pgiomap_bobtype,
pargrp_iomap   
)

BOB definitions for the assorted parts of io requests and nwxfer

◆ M0_BOB_DEFINE() [2/2]

M0_BOB_DEFINE ( M0_INTERNAL  ,
dtbuf_bobtype,
data_buf   
)

◆ mark_page_as_read_failed()

static void mark_page_as_read_failed ( struct pargrp_iomap map,
uint32_t  row,
uint32_t  col,
enum page_attr  page_type 
)
static

Updates the page attributes in a degraded mode IO.

This is heavily based on m0t1fs/linux_kernel/file.cmark_page_as_read_failed.

Parameters
mapThe parity map in question.
rowThe 'row' of this 'page'(unit) in a parity group.
colThe 'col' of this 'page'(unit) in a parity group.
Returns
null

Definition at line 1631 of file io_pargrp.c.

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

◆ offset_get()

static size_t offset_get ( struct pargrp_iomap map)
static

Definition at line 2101 of file io_pargrp.c.

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

◆ pargrp_id_find()

M0_INTERNAL uint64_t pargrp_id_find ( m0_bindex_t  index,
const struct m0_op_io ioo,
const struct ioreq_fop ir_fop 
)

This is heavily based on m0t1fs/linux_kernel/file.cpargrp_id_find

Definition at line 105 of file io_pargrp.c.

Here is the call graph for this function:

◆ pargrp_iomap_auxbuf_alloc()

static uint64_t pargrp_iomap_auxbuf_alloc ( struct pargrp_iomap map,
uint32_t  row,
uint32_t  col 
)
static

Allocates an auxillary buffer for this row/column in the parity group map. This is used for read modify write, and possibly parity validation. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_auxbuf_alloc

Parameters
mapThe io map in question.
rowThe row to allocate the data_buf in.
colThe column to allocate the data_buf in.
Returns
0 for success, or -ENOMEM.

Definition at line 931 of file io_pargrp.c.

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

◆ pargrp_iomap_bufs_alloc()

static int pargrp_iomap_bufs_alloc ( struct data_buf ****  bufs_out,
uint32_t  row_nr,
uint32_t  col_nr 
)
static

Definition at line 2362 of file io_pargrp.c.

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

◆ pargrp_iomap_bufs_free()

static void pargrp_iomap_bufs_free ( struct data_buf ***  bufs,
int  nr 
)
static

Definition at line 2353 of file io_pargrp.c.

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

◆ pargrp_iomap_databuf_alloc()

static int pargrp_iomap_databuf_alloc ( struct pargrp_iomap map,
uint32_t  row,
uint32_t  col,
struct m0_bufvec_cursor data 
)
static

Allocates this entry in the column/row table of the iomap. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_databuf_alloc

Parameters
mapThe io map in question.
rowThe row to allocate the data_buf in.
colThe column to allocate the data_buf in.
Returns
0 for success, or -ENOMEM.

Definition at line 877 of file io_pargrp.c.

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

◆ pargrp_iomap_databuf_replicate()

static int pargrp_iomap_databuf_replicate ( struct pargrp_iomap map)
static

Definition at line 1387 of file io_pargrp.c.

Here is the call graph for this function:

◆ pargrp_iomap_dgmode_postprocess()

static int pargrp_iomap_dgmode_postprocess ( struct pargrp_iomap map)
static

Re-organises and allocates buffers for data and parity matrices. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_dgmode_recover.

Parameters
mapThe parity map in question.
Returns
0 for success, -errno otherwise.

Code related to inode->i_size has been removed. (sining)

Definition at line 1822 of file io_pargrp.c.

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

◆ pargrp_iomap_dgmode_process()

static int pargrp_iomap_dgmode_process ( struct pargrp_iomap map,
struct target_ioreq tio,
m0_bindex_t index,
uint32_t  count 
)
static

Mark those units on 'bad' devices and allocated neccessary resources for later degraded IO. (Note: special treatment for device with M0_PNDS_SNS_REPAIRED state as new IO requests will be issued accoding to new layout.)

This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_dgmode_process.

Parameters
mapThe parity map in question.
tioThe target IO request in question.
indexThe starting offset.
count(not used at all. ???).
Returns
0 for success, -errno otherwise.

Code related to inode->i_size has been removed. (sining)

Definition at line 1704 of file io_pargrp.c.

Here is the call graph for this function:

◆ pargrp_iomap_dgmode_recover()

static int pargrp_iomap_dgmode_recover ( struct pargrp_iomap map)
static

Reconstructs the missing units of a parity group. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_dgmode_recover.

Parameters
mapThe parity map in question.
Returns
0 for success, -errno otherwise.

Definition at line 1985 of file io_pargrp.c.

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

◆ pargrp_iomap_fini()

M0_INTERNAL void pargrp_iomap_fini ( struct pargrp_iomap map,
struct m0_obj obj 
)

This is heavily based on m0t1fs/linux_kernel/file.c::pargrp_iomap_finiTODO: arguments here can be reduced, map+obj are in ioo

Definition at line 2467 of file io_pargrp.c.

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

◆ pargrp_iomap_fullpages_count()

static uint64_t pargrp_iomap_fullpages_count ( struct pargrp_iomap map)
static
Todo:
: all client buffers should be PA_FULLPAGE_MODIFY - rip all this out

Counts the number of buffers in the parity group map that have the PA_FULLPAGE_MODIFY flag set. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_fullpages_count

Parameters
mapThe parity group io map to inspect.
Returns
The number of buffers in the parity group that have PA_FULLPAGE_MODIFY set.

Definition at line 685 of file io_pargrp.c.

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

◆ pargrp_iomap_init()

M0_INTERNAL int pargrp_iomap_init ( struct pargrp_iomap map,
struct m0_op_io ioo,
uint64_t  grpid 
)

This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_init

Definition at line 2387 of file io_pargrp.c.

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

◆ pargrp_iomap_invariant()

M0_INTERNAL bool pargrp_iomap_invariant ( const struct pargrp_iomap map)

This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_invariant

Definition at line 203 of file io_pargrp.c.

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

◆ pargrp_iomap_invariant_nr()

M0_INTERNAL bool pargrp_iomap_invariant_nr ( const struct m0_op_io ioo)

This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_invariant_nr

Definition at line 227 of file io_pargrp.c.

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

◆ pargrp_iomap_pages_mark_as_failed()

static int pargrp_iomap_pages_mark_as_failed ( struct pargrp_iomap map,
enum m0_pdclust_unit_type  type 
)
static

Marks [data | parity]units of a parity group to PA_READ_FAILED if any of the units of same type 'type' is PA_READ_FAILED.

This is heavily based on m0t1fs/linux_kernel/file.c::pargrp_iomap_pages_mark.

Parameters
mapThe parity map in question.
typeThe type of units in a group.
Returns
0 for success, -errno otherwise.

Definition at line 1457 of file io_pargrp.c.

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

◆ pargrp_iomap_parity_recalc()

static int pargrp_iomap_parity_recalc ( struct pargrp_iomap map)
static

Calculates parity of data buffers. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_parity_recalc

Parameters
mapThe parity group to calculate the parity for.

Definition at line 1163 of file io_pargrp.c.

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

◆ pargrp_iomap_parity_verify()

static int pargrp_iomap_parity_verify ( struct pargrp_iomap map)
static

Definition at line 2231 of file io_pargrp.c.

Here is the call graph for this function:

◆ pargrp_iomap_paritybufs_alloc()

static int pargrp_iomap_paritybufs_alloc ( struct pargrp_iomap map)
static

Allocates parity buffers for this iomap. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_paritybufs_alloc

Parameters
mapThe parity group iomap in question.
Returns
0 for success, -errno otherwise.

Definition at line 1296 of file io_pargrp.c.

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

◆ pargrp_iomap_populate()

static int pargrp_iomap_populate ( struct pargrp_iomap map,
struct m0_ivec_cursor cursor,
struct m0_bufvec_cursor buf_cursor 
)
static

Builds the iomap structure of row/columns for data/parity, one segment at a time. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_populate

Parameters
map[out]The map top populate.
ivecThe extents of the global file we will operate on.
cursorWhere in which extent we should start.
Returns
0 for sucess, -errno otherwise.

Definition at line 578 of file io_pargrp.c.

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

◆ pargrp_iomap_populate_pi_ivec()

static int pargrp_iomap_populate_pi_ivec ( struct pargrp_iomap map,
struct m0_ivec_cursor cursor,
struct m0_bufvec_cursor buf_cursor,
bool  rmw 
)
static

Populate parity group pi_ivec from user ivec at cursor and allocate pi_databufs structures correspondingly.

Definition at line 427 of file io_pargrp.c.

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

◆ pargrp_iomap_readold_auxbuf_alloc()

static int pargrp_iomap_readold_auxbuf_alloc ( struct pargrp_iomap map)
static

Allocates auxillary buffers for read-old-mode for each buffer in the parity group. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_readold_auxbuf_alloc

Parameters
mapThe io map in question.
Returns
0 on success, -errno otherwise.

Definition at line 962 of file io_pargrp.c.

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

◆ pargrp_iomap_readrest()

static int pargrp_iomap_readrest ( struct pargrp_iomap map)
static

Reads the remainder of a parity group row so that parity can be generated in a read-modify-write scenario. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_readrest

A read request from rmw IO request can lead to either:

read_old - Read the old data for the extent spanned by current IO request, along with the old parity unit. This approach needs to calculate new parity in iterative manner. This approach is selected only if current IO extent lies within file size.

read_rest - Read rest of the parity group, which is not spanned by current IO request, so that data for whole parity group can be availble for parity calculation. This approach reads the extent from start of parity group to the point where a page is completely spanned by incoming IO request.

Typically, the approach which leads to least size of data to be read and written from server is selected.

N = 5, P = 1, K = 1, unit_size = 4k F => Fully occupied P' => Partially occupied

=> Parity unit

  • => Spare unit x => Start of actual file extent. y => End of actual file extent. a => Rounded down value of x. b => Rounded up value of y.

Read-rest approach (XXX Sining: these diagrams don't seem right)

a x +—+—+—+—+—+—+—+ | | P'| F | F | F | # | * | PG#0 +—+—+—+—+—+—+—+ | F | F | F | F | F | # | * | PG#1 +—+—+—+—+—+—+—+ | F | F | F | P'| | # | * | PG#2 +—+—+—+—+—+—+—+ N N N N N K P y b

Read-old approach

a x +—+—+—+—+—+—+—+ | | | | P'| F | # | * | PG#0 +—+—+—+—+—+—+—+ | F | F | F | F | F | # | * | PG#1 +—+—+—+—+—+—+—+ | F | P'| | | | # | * | PG#2 +—+—+—+—+—+—+—+ N N N N N K P y b

Definition at line 1084 of file io_pargrp.c.

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

◆ pargrp_iomap_replica_elect()

static int pargrp_iomap_replica_elect ( struct pargrp_iomap map)
static

TODO: initiate a write on affected page.

Store the index of majority element with rest of the members.

Definition at line 2112 of file io_pargrp.c.

Here is the call graph for this function:

◆ pargrp_iomap_seg_process()

static int pargrp_iomap_seg_process ( struct pargrp_iomap map,
uint32_t  seg,
bool  rmw,
uint64_t  skip_buf_index,
struct m0_bufvec_cursor buf_cursor 
)
static

Allocates data_buf structures as needed and populates the buffer flags. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_init.

Parameters
map[out]The parity group map to be processed.
segWhich segment to start processing.
rmwWhether to skip on allocation as memory will be allocated once old data has been read.
Returns
0 for success, -errno otherwise.

Definition at line 755 of file io_pargrp.c.

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

◆ pargrp_iomap_select_ro_rr()

static int pargrp_iomap_select_ro_rr ( struct pargrp_iomap map,
m0_bcount_t  data_pages_nr,
m0_bcount_t  parity_pages_nr 
)
static

Decides whether to undertake a read-old or read-rest approach for the parity group RMW IO request based on the total number of pages to be read and written.

In read-old approach, the old data and parity units are read and the new parity is calculated incrementally based on the difference between old and new data and parity units.

In read-rest approach, the rest data units of the group are read and the new parity is calculated based on them and the new data units to be written.

In both approaches, the number of units to be written is the same (new data units and udpated parity units), so we compare only the number of units (pages) to be read.

By default, the segments in index vector pargrp_iomap::pi_ivec are suitable for read-old approach. Hence the index vector is changed only if read-rest approach is selected.

Parameters
mapis the parity group iomap
data_pages_nris the number of data pages in group
parity_pages_nris the number of parity pages in group

Definition at line 533 of file io_pargrp.c.

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

◆ pargrp_iomap_spans_seg()

static bool pargrp_iomap_spans_seg ( struct pargrp_iomap map,
m0_bindex_t  index,
m0_bcount_t  count 
)
static

Determines if the count bytes from index are covered by a single segment in the iomap's index-vector. This is heavily based on m0t1fs/linux_kernel/file.cpargrp_iomap_spans_seg

Parameters
mapThe map to inspect.
indexThe starting offset.
countThe number of bytes that should be covered.
Returns
true or false.

Definition at line 728 of file io_pargrp.c.

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

◆ pargrp_src_addr()

static void pargrp_src_addr ( m0_bindex_t  index,
const struct m0_op_io ioo,
const struct target_ioreq tio_req,
struct m0_pdclust_src_addr src 
)
static

Finds the parity group associated with a given target offset.

Parameters
indexThe target offset for intended IO.
reqIO-request holding information about IO.
tio_reqThe io-request for given target.
outputThe parity group.

Definition at line 84 of file io_pargrp.c.

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

◆ seg_align()

static void seg_align ( struct pargrp_iomap map,
uint32_t  seg,
m0_bindex_t  end,
uint64_t  sz 
)
static

Make segment sz-aligned down and up.

Definition at line 414 of file io_pargrp.c.

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

◆ seg_idx_inc_round()

static void seg_idx_inc_round ( struct pargrp_iomap map,
uint32_t  seg,
uint64_t  sz 
)
static

Increase segment's index by sz-aligned value.

Definition at line 404 of file io_pargrp.c.

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

◆ seg_set()

static m0_bindex_t seg_set ( struct pargrp_iomap map,
uint32_t  seg,
struct m0_ivec_cursor cur,
m0_bindex_t  grpend 
)
static

Set segment by countiguous user ivec starting from cursor position at most to the parity group end. If the contiguous user ivec is less than the group end, the resulting segment will be only up to the end of that contiguous ivec.

See also
doc for m0_ivec_cursor_conti().

Definition at line 392 of file io_pargrp.c.

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

◆ unit_state()

static int unit_state ( const struct m0_pdclust_src_addr src,
struct m0_op_io ioo,
enum m0_pool_nd_state state 
)
static

Gets the state of node where the unit(src) is.

This is heavily based on m0t1fs/linux_kernel/file.cunit_state.

Parameters
srcThe unit in question.
iooThe io operation.
stateThe pointer to the returned state.
Returns
0 for success, -errno otherwise.

Definition at line 1541 of file io_pargrp.c.

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

Variable Documentation

◆ dtbuf_bobtype

const struct m0_bob_type dtbuf_bobtype
Initial value:
= {
.bt_name = "data_buf_bobtype",
.bt_magix_offset = offsetof(struct data_buf, db_magic),
.bt_magix = M0_DTBUF_MAGIC,
.bt_check = NULL,
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 55 of file io_pargrp.c.

◆ iomap_ops

const struct pargrp_iomap_ops iomap_ops
static
Initial value:
= {
.pi_populate = pargrp_iomap_populate,
.pi_spans_seg = pargrp_iomap_spans_seg,
.pi_fullpages_find = pargrp_iomap_fullpages_count,
.pi_seg_process = pargrp_iomap_seg_process,
.pi_databuf_alloc = pargrp_iomap_databuf_alloc,
.pi_readrest = pargrp_iomap_readrest,
.pi_readold_auxbuf_alloc = pargrp_iomap_readold_auxbuf_alloc,
.pi_parity_recalc = pargrp_iomap_parity_recalc,
.pi_parity_verify = pargrp_iomap_parity_verify,
.pi_parity_replica_verify = pargrp_iomap_replica_elect,
.pi_data_replicate = pargrp_iomap_databuf_replicate,
.pi_paritybufs_alloc = pargrp_iomap_paritybufs_alloc,
.pi_dgmode_process = pargrp_iomap_dgmode_process,
.pi_dgmode_postprocess = pargrp_iomap_dgmode_postprocess,
.pi_dgmode_recover = pargrp_iomap_dgmode_recover,
.pi_replica_recover = pargrp_iomap_replica_elect,
}
static int pargrp_iomap_dgmode_process(struct pargrp_iomap *map, struct target_ioreq *tio, m0_bindex_t *index, uint32_t count)
Definition: io_pargrp.c:1704
static uint64_t pargrp_iomap_fullpages_count(struct pargrp_iomap *map)
Definition: io_pargrp.c:685
static int pargrp_iomap_populate(struct pargrp_iomap *map, struct m0_ivec_cursor *cursor, struct m0_bufvec_cursor *buf_cursor)
Definition: io_pargrp.c:578
static int pargrp_iomap_readrest(struct pargrp_iomap *map)
Definition: io_pargrp.c:1084
static int pargrp_iomap_parity_recalc(struct pargrp_iomap *map)
Definition: io_pargrp.c:1163
static int pargrp_iomap_replica_elect(struct pargrp_iomap *map)
Definition: io_pargrp.c:2112
static bool pargrp_iomap_spans_seg(struct pargrp_iomap *map, m0_bindex_t index, m0_bcount_t count)
Definition: io_pargrp.c:728
static int pargrp_iomap_parity_verify(struct pargrp_iomap *map)
Definition: io_pargrp.c:2231
static int pargrp_iomap_dgmode_postprocess(struct pargrp_iomap *map)
Definition: io_pargrp.c:1822
static int pargrp_iomap_readold_auxbuf_alloc(struct pargrp_iomap *map)
Definition: io_pargrp.c:962
static int pargrp_iomap_databuf_alloc(struct pargrp_iomap *map, uint32_t row, uint32_t col, struct m0_bufvec_cursor *data)
Definition: io_pargrp.c:877
static int pargrp_iomap_dgmode_recover(struct pargrp_iomap *map)
Definition: io_pargrp.c:1985
static int pargrp_iomap_paritybufs_alloc(struct pargrp_iomap *map)
Definition: io_pargrp.c:1296
static int pargrp_iomap_seg_process(struct pargrp_iomap *map, uint32_t seg, bool rmw, uint64_t skip_buf_index, struct m0_bufvec_cursor *buf_cursor)
Definition: io_pargrp.c:755
static int pargrp_iomap_databuf_replicate(struct pargrp_iomap *map)
Definition: io_pargrp.c:1387

Definition at line 2334 of file io_pargrp.c.

◆ pgiomap_bobtype

const struct m0_bob_type pgiomap_bobtype
Initial value:
= {
.bt_name = "pargrp_iomap_bobtype",
.bt_magix_offset = offsetof(struct pargrp_iomap, pi_magic),
.bt_magix = M0_PGROUP_MAGIC,
.bt_check = NULL,
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Explantation of object block, parity group unit and page.

An object is viewed as a stream of blocks (1-dimension). When an object is stored in motr, it is transformed into a 2-dimenional parity group matrix. The size of object block is set by Client applications and should be >= (1 >> M0_MIN_BUF_SHIFT) and <= parity group unit size. So a number of blocks may be assemblied into one parity data unit and stored together.

page is something Client inherits from m0t1fs as m0t1fs uses kernel pages. It serves as the in-memory representation of an object block.BOB types for the assorted parts of io requests and nwxfer

BOB initialisation for the assorted parts of io requests and nwxfer

Definition at line 54 of file io_pargrp.c.