Motr  M0
composite_layout.c File Reference
#include "lib/trace.h"
#include "lib/finject.h"
#include "lib/errno.h"
#include "lib/vec.h"
#include "lib/byteorder.h"
#include "fid/fid.h"
#include "motr/client.h"
#include "motr/client_internal.h"
#include "motr/layout.h"
#include "dix/meta.h"
#include "dix/layout.h"
Include dependency graph for composite_layout.c:

Go to the source code of this file.

Data Structures

struct  layout_dix_req
 
struct  composite_sub_io_ext
 
struct  composite_sub_io
 

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT
 

Enumerations

enum  { M0_COMPOSITE_EXTENT_SCAN_BATCH = 5 }
 

Functions

 M0_TL_DESCR_DEFINE (clayer, "composite layout layers", static, struct m0_composite_layer, ccr_tlink, ccr_tlink_magic, M0_CLAYER_TL_MAGIC, M0_CLAYER_TL_MAGIC)
 
 M0_TL_DEFINE (clayer, static, struct m0_composite_layer)
 
 M0_TL_DESCR_DEFINE (cext, "composite layout extents", static, struct m0_composite_extent, ce_tlink, ce_tlink_magic, M0_CEXT_TL_MAGIC, M0_CEXT_TL_MAGIC)
 
 M0_TL_DEFINE (cext, static, struct m0_composite_extent)
 
static int composite_layout_io_build (struct m0_io_args *args, struct m0_op **op)
 
static int composite_extents_scan_sync (struct m0_obj *obj, struct m0_client_composite_layout *clayout)
 
static struct layout_dix_reqlayout_dix_req_alloc (struct m0_sm_group *grp, struct m0_dix_cli *cli, m0_chan_cb_t cb, struct m0_op_layout *ol)
 
static void layout_dix_req_fini (struct layout_dix_req *req)
 
static void layout_dix_req_free (struct layout_dix_req *req)
 
static void layout_op_completed (struct m0_op *op)
 
static void layout_op_failed (struct m0_op *op, int rc)
 
static void layout_dix_req_ast (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static bool layout_dix_req_clink_cb (struct m0_clink *cl)
 
static void layout_dix_get_ast (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void layout_dix_put_ast (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void layout_dix_req_launch (struct layout_dix_req *req, void(*exec_fn)(struct m0_sm_group *grp, struct m0_sm_ast *ast))
 
M0_INTERNAL int m0_layout_op_launch (struct m0_op_layout *ol)
 
M0_INTERNAL int m0__dix_layout_get_sync (struct m0_obj *obj, struct m0_dix_layout *dlayout)
 
static int composite_layout_copy_to_app (struct m0_client_layout *to, void *from)
 
static int composite_layout_copy_from_app (struct m0_client_layout *from, void *to)
 
static int composite_layout_get_sync (struct m0_obj *obj)
 
static int composite_layout_get (struct m0_client_layout *layout)
 
static void composite_layout_put (struct m0_client_layout *layout)
 
static int composite_layout_alloc (struct m0_client_layout **out)
 
int m0_composite_layer_add (struct m0_client_layout *layout, struct m0_obj *sub_obj, int priority)
 
void m0_composite_layer_del (struct m0_client_layout *layout, struct m0_uint128 subobj_id)
 
 M0_TL_DESCR_DEFINE (sio_ext, "composite layout subobj extent list", static, struct composite_sub_io_ext, sie_tlink, sie_tlink_magic, M0_CIO_EXT_MAGIC, M0_CIO_EXT_MAGIC)
 
 M0_TL_DEFINE (sio_ext, static, struct composite_sub_io_ext)
 
 M0_BOB_DEFINE (static, &oci_bobtype, m0_op_composite_io)
 
static bool m0_op_composite_io_invariant (const struct m0_op_composite_io *oci)
 
static void composite_sub_io_destroy (struct composite_sub_io *sio_arr, int nr_subobjs)
 
static m0_bindex_t get_next_off (struct m0_composite_extent *cexts[], int n)
 
static void advance_layers_cursor (struct m0_tl *cext_tlists[], struct m0_composite_extent *cexts[], int n, m0_bindex_t off)
 
static int composite_io_divide (struct m0_client_composite_layout *clayout, enum m0_obj_opcode opcode, struct m0_indexvec *ext, struct m0_bufvec *data, struct composite_sub_io **out, int *out_nr_sios)
 
static void composite_io_op_done (struct m0_op_composite_io *oci)
 
static void composite_io_op_ast (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static int composite_sub_io_op_build (struct m0_obj *cobj, struct m0_op *cop, struct composite_sub_io *sio, struct m0_op **out)
 
static int composite_sub_io_ops_build (struct m0_obj *cobj, struct m0_op *cop, struct composite_sub_io *sio_arr, int nr_subobjs)
 
static void composite_io_op_cb_fini (struct m0_op_common *oc)
 
static void composite_io_op_cb_free (struct m0_op_common *oc)
 
static void composite_io_op_cb_launch (struct m0_op_common *oc)
 
static int composite_io_op_init (struct m0_obj *obj, int opcode, struct m0_op *op)
 
int m0_composite_layer_idx_key_to_buf (struct m0_composite_layer_idx_key *key, void **out_kbuf, m0_bcount_t *out_klen)
 
void m0_composite_layer_idx_key_from_buf (struct m0_composite_layer_idx_key *key, void *kbuf)
 
int m0_composite_layer_idx_val_to_buf (struct m0_composite_layer_idx_val *val, void **out_vbuf, m0_bcount_t *out_vlen)
 
void m0_composite_layer_idx_val_from_buf (struct m0_composite_layer_idx_val *val, void *vbuf)
 
int m0_composite_layer_idx (struct m0_uint128 layer_id, bool write, struct m0_idx *idx)
 
M0_INTERNAL int m0__composite_container_init (struct m0_client *cinst)
 
static int composite_layer_idx_next_query (struct m0_idx *idx, struct m0_bufvec *keys, struct m0_bufvec *vals, int *rcs, uint32_t flags)
 
static int composite_layer_idx_extents_extract (struct m0_composite_layer *layer, struct m0_bufvec *keys, struct m0_bufvec *vals, int *rcs, struct m0_tl *ext_list, struct m0_composite_layer_idx_key *max_key)
 
static int composite_layer_idx_scan (struct m0_composite_layer *layer, bool is_wr_list)
 

Variables

const struct m0_op_layout_ops m0_op_layout_composite_ops
 
const struct m0_client_layout_ops layout_composite_ops
 
static const struct m0_bob_type oci_bobtype
 
struct m0_fid composite_extent_rd_idx_fid = M0_FID_TINIT('x', 0, 0x10)
 
struct m0_fid composite_extent_wr_idx_fid = M0_FID_TINIT('x', 0, 0x11)
 
static struct m0_container composite_container
 

Macro Definition Documentation

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT

Definition at line 22 of file composite_layout.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
M0_COMPOSITE_EXTENT_SCAN_BATCH 

Definition at line 1231 of file composite_layout.c.

Function Documentation

◆ advance_layers_cursor()

static void advance_layers_cursor ( struct m0_tl cext_tlists[],
struct m0_composite_extent cexts[],
int  n,
m0_bindex_t  off 
)
static

Definition at line 700 of file composite_layout.c.

Here is the caller graph for this function:

◆ composite_extents_scan_sync()

static int composite_extents_scan_sync ( struct m0_obj obj,
struct m0_client_composite_layout clayout 
)
static

Definition at line 1520 of file composite_layout.c.

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

◆ composite_io_divide()

static int composite_io_divide ( struct m0_client_composite_layout clayout,
enum m0_obj_opcode  opcode,
struct m0_indexvec ext,
struct m0_bufvec data,
struct composite_sub_io **  out,
int *  out_nr_sios 
)
static

Definition at line 720 of file composite_layout.c.

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

◆ composite_io_op_ast()

static void composite_io_op_ast ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 872 of file composite_layout.c.

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

◆ composite_io_op_cb_fini()

static void composite_io_op_cb_fini ( struct m0_op_common oc)
static

Definition at line 1014 of file composite_layout.c.

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

◆ composite_io_op_cb_free()

static void composite_io_op_cb_free ( struct m0_op_common oc)
static

Definition at line 1052 of file composite_layout.c.

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

◆ composite_io_op_cb_launch()

static void composite_io_op_cb_launch ( struct m0_op_common oc)
static

Definition at line 1088 of file composite_layout.c.

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

◆ composite_io_op_done()

static void composite_io_op_done ( struct m0_op_composite_io oci)
static

Definition at line 833 of file composite_layout.c.

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

◆ composite_io_op_init()

static int composite_io_op_init ( struct m0_obj obj,
int  opcode,
struct m0_op op 
)
static

Definition at line 1122 of file composite_layout.c.

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

◆ composite_layer_idx_extents_extract()

static int composite_layer_idx_extents_extract ( struct m0_composite_layer layer,
struct m0_bufvec keys,
struct m0_bufvec vals,
int *  rcs,
struct m0_tl ext_list,
struct m0_composite_layer_idx_key max_key 
)
static

Definition at line 1367 of file composite_layout.c.

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

◆ composite_layer_idx_next_query()

static int composite_layer_idx_next_query ( struct m0_idx idx,
struct m0_bufvec keys,
struct m0_bufvec vals,
int *  rcs,
uint32_t  flags 
)
static

Definition at line 1343 of file composite_layout.c.

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

◆ composite_layer_idx_scan()

static int composite_layer_idx_scan ( struct m0_composite_layer layer,
bool  is_wr_list 
)
static

Definition at line 1410 of file composite_layout.c.

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

◆ composite_layout_alloc()

static int composite_layout_alloc ( struct m0_client_layout **  out)
static

Definition at line 505 of file composite_layout.c.

Here is the call graph for this function:

◆ composite_layout_copy_from_app()

static int composite_layout_copy_from_app ( struct m0_client_layout from,
void *  to 
)
static

Definition at line 413 of file composite_layout.c.

Here is the call graph for this function:

◆ composite_layout_copy_to_app()

static int composite_layout_copy_to_app ( struct m0_client_layout to,
void *  from 
)
static

------------------------------------------------------------------------—*

Client COMPOSITE LAYOUT OP APIS and routines *

Definition at line 374 of file composite_layout.c.

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

◆ composite_layout_get()

static int composite_layout_get ( struct m0_client_layout layout)
static

Definition at line 464 of file composite_layout.c.

Here is the call graph for this function:

◆ composite_layout_get_sync()

static int composite_layout_get_sync ( struct m0_obj obj)
static

Definition at line 453 of file composite_layout.c.

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

◆ composite_layout_io_build()

static int composite_layout_io_build ( struct m0_io_args args,
struct m0_op **  op 
)
static

Definition at line 1178 of file composite_layout.c.

Here is the call graph for this function:

◆ composite_layout_put()

static void composite_layout_put ( struct m0_client_layout layout)
static

Definition at line 486 of file composite_layout.c.

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

◆ composite_sub_io_destroy()

static void composite_sub_io_destroy ( struct composite_sub_io sio_arr,
int  nr_subobjs 
)
static

Definition at line 665 of file composite_layout.c.

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

◆ composite_sub_io_op_build()

static int composite_sub_io_op_build ( struct m0_obj cobj,
struct m0_op cop,
struct composite_sub_io sio,
struct m0_op **  out 
)
static

Create an IO op for the sub object. CKSUM_TODO: calculate cksum and pass in attr instead of NULL

Definition at line 903 of file composite_layout.c.

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

◆ composite_sub_io_ops_build()

static int composite_sub_io_ops_build ( struct m0_obj cobj,
struct m0_op cop,
struct composite_sub_io sio_arr,
int  nr_subobjs 
)
static

Definition at line 976 of file composite_layout.c.

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

◆ get_next_off()

static m0_bindex_t get_next_off ( struct m0_composite_extent cexts[],
int  n 
)
static

Definition at line 681 of file composite_layout.c.

Here is the caller graph for this function:

◆ layout_dix_get_ast()

static void layout_dix_get_ast ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 211 of file composite_layout.c.

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

◆ layout_dix_put_ast()

static void layout_dix_put_ast ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 235 of file composite_layout.c.

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

◆ layout_dix_req_alloc()

static struct layout_dix_req* layout_dix_req_alloc ( struct m0_sm_group grp,
struct m0_dix_cli cli,
m0_chan_cb_t  cb,
struct m0_op_layout ol 
)
static

Definition at line 66 of file composite_layout.c.

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

◆ layout_dix_req_ast()

static void layout_dix_req_ast ( struct m0_sm_group grp,
struct m0_sm_ast ast 
)
static

Definition at line 128 of file composite_layout.c.

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

◆ layout_dix_req_clink_cb()

static bool layout_dix_req_clink_cb ( struct m0_clink cl)
static

Definition at line 179 of file composite_layout.c.

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

◆ layout_dix_req_fini()

static void layout_dix_req_fini ( struct layout_dix_req req)
static

Definition at line 82 of file composite_layout.c.

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

◆ layout_dix_req_free()

static void layout_dix_req_free ( struct layout_dix_req req)
static

Definition at line 88 of file composite_layout.c.

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

◆ layout_dix_req_launch()

static void layout_dix_req_launch ( struct layout_dix_req req,
void(*)(struct m0_sm_group *grp, struct m0_sm_ast *ast exec_fn 
)
static

Definition at line 286 of file composite_layout.c.

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

◆ layout_op_completed()

static void layout_op_completed ( struct m0_op op)
static

Definition at line 93 of file composite_layout.c.

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

◆ layout_op_failed()

static void layout_op_failed ( struct m0_op op,
int  rc 
)
static

Definition at line 111 of file composite_layout.c.

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

◆ m0__composite_container_init()

M0_INTERNAL int m0__composite_container_init ( struct m0_client cinst)

Definition at line 1330 of file composite_layout.c.

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

◆ m0__dix_layout_get_sync()

M0_INTERNAL int m0__dix_layout_get_sync ( struct m0_obj obj,
struct m0_dix_layout dlayout 
)

Definition at line 328 of file composite_layout.c.

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

◆ M0_BOB_DEFINE()

M0_BOB_DEFINE ( static  ,
oci_bobtype,
m0_op_composite_io   
)

◆ m0_layout_op_launch()

M0_INTERNAL int m0_layout_op_launch ( struct m0_op_layout ol)

Definition at line 297 of file composite_layout.c.

Here is the call graph for this function:

◆ m0_op_composite_io_invariant()

static bool m0_op_composite_io_invariant ( const struct m0_op_composite_io oci)
static

Definition at line 655 of file composite_layout.c.

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

◆ M0_TL_DEFINE() [1/3]

M0_TL_DEFINE ( clayer  ,
static  ,
struct m0_composite_layer   
)

◆ M0_TL_DEFINE() [2/3]

M0_TL_DEFINE ( cext  ,
static  ,
struct m0_composite_extent   
)

◆ M0_TL_DEFINE() [3/3]

M0_TL_DEFINE ( sio_ext  ,
static  ,
struct composite_sub_io_ext   
)

◆ M0_TL_DESCR_DEFINE() [1/3]

M0_TL_DESCR_DEFINE ( clayer  ,
"composite layout layers"  ,
static  ,
struct m0_composite_layer  ,
ccr_tlink  ,
ccr_tlink_magic  ,
M0_CLAYER_TL_MAGIC  ,
M0_CLAYER_TL_MAGIC   
)

◆ M0_TL_DESCR_DEFINE() [2/3]

M0_TL_DESCR_DEFINE ( cext  ,
"composite layout extents"  ,
static  ,
struct m0_composite_extent  ,
ce_tlink  ,
ce_tlink_magic  ,
M0_CEXT_TL_MAGIC  ,
M0_CEXT_TL_MAGIC   
)

◆ M0_TL_DESCR_DEFINE() [3/3]

M0_TL_DESCR_DEFINE ( sio_ext  ,
"composite layout subobj extent list ,
static  ,
struct composite_sub_io_ext  ,
sie_tlink  ,
sie_tlink_magic  ,
M0_CIO_EXT_MAGIC  ,
M0_CIO_EXT_MAGIC   
)

Variable Documentation

◆ composite_container

struct m0_container composite_container
static

Definition at line 1229 of file composite_layout.c.

◆ composite_extent_rd_idx_fid

struct m0_fid composite_extent_rd_idx_fid = M0_FID_TINIT('x', 0, 0x10)

---------------------------------------------------------------------——*

Client Composite Layout Extent Index API and routines *

2 global extent indices are created for composite objects' extents: one is for read extents and another is for write extents. Client uses two reserved FIDs for these 2 global extent indices. The format for key/value pairs is defined as: key = {layer_id, extent offset} and value = extent length To ensure that the key/value pairs are stored in key's lexicographical, order (so that extents for a layer is stored in increasing offset order), client transforms the keys input by the application in big-endian format.

To create these internal extent indices, client also has to maintain an container for it.

Definition at line 1225 of file composite_layout.c.

◆ composite_extent_wr_idx_fid

struct m0_fid composite_extent_wr_idx_fid = M0_FID_TINIT('x', 0, 0x11)

Definition at line 1226 of file composite_layout.c.

◆ layout_composite_ops

const struct m0_client_layout_ops layout_composite_ops
Initial value:
= {
.lo_io_build = composite_layout_io_build,
}
static void composite_layout_put(struct m0_client_layout *layout)
static int composite_layout_get(struct m0_client_layout *layout)
static int composite_layout_alloc(struct m0_client_layout **out)
static int composite_layout_io_build(struct m0_io_args *args, struct m0_op **op)

Definition at line 528 of file composite_layout.c.

◆ m0_op_layout_composite_ops

const struct m0_op_layout_ops m0_op_layout_composite_ops
Initial value:
= {
.olo_launch = m0_layout_op_launch,
.olo_copy_to_app = composite_layout_copy_to_app,
.olo_copy_from_app = composite_layout_copy_from_app,
}
M0_INTERNAL int m0_layout_op_launch(struct m0_op_layout *ol)
static int composite_layout_copy_from_app(struct m0_client_layout *from, void *to)
static int composite_layout_copy_to_app(struct m0_client_layout *to, void *from)

Definition at line 447 of file composite_layout.c.

◆ oci_bobtype

static const struct m0_bob_type oci_bobtype
static
Initial value:
= {
.bt_name = "oci_bobtype",
.bt_magix_offset = offsetof(struct m0_op_composite_io, oci_magic),
.bt_magix = M0_OCI_MAGIC,
.bt_check = NULL,
}
#define NULL
Definition: misc.h:38
#define offsetof(typ, memb)
Definition: misc.h:29

Definition at line 645 of file composite_layout.c.