Motr  M0
io_req_fop.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 "motr/sync.h"
#include "lib/memory.h"
#include "lib/errno.h"
#include "lib/atomic.h"
#include "lib/cksum_utils.h"
#include "rpc/rpc_machine_internal.h"
#include "fop/fom_generic.h"
#include "cob/cob.h"
#include "rpc/addb2.h"
#include "rpc/item.h"
#include "rpc/rpc_internal.h"
#include "lib/trace.h"
Include dependency graph for io_req_fop.c:

Go to the source code of this file.

Macros

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT
 
#define LOGMSG(ioo, rc, tireq)
 

Functions

 M0_BOB_DEFINE (M0_INTERNAL, &iofop_bobtype, ioreq_fop)
 
 M0_TL_DESCR_DEFINE (iofops, "List of IO fops", M0_INTERNAL, struct ioreq_fop, irf_link, irf_magic, M0_IOFOP_MAGIC, M0_TIOREQ_MAGIC)
 
 M0_TL_DEFINE (iofops, M0_INTERNAL, struct ioreq_fop)
 
M0_INTERNAL bool ioreq_fop_invariant (const struct ioreq_fop *fop)
 
static bool should_ioreq_sm_complete (struct m0_op_io *ioo)
 
M0_INTERNAL struct m0_filem0_client_fop_to_file (struct m0_fop *fop)
 
static void application_attribute_copy (struct m0_indexvec *rep_ivec, struct target_ioreq *ti, struct m0_op_io *ioo, struct m0_buf *buf)
 
static void io_bottom_half (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void io_rpc_item_cb (struct m0_rpc_item *item)
 
static void ioreq_cc_bottom_half (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void ioreq_cc_rpc_item_cb (struct m0_rpc_item *item)
 
static void m0_sm_io_done_ast (struct m0_sm_group *grp, struct m0_sm_ast *ast)
 
static void client_passive_recv (const struct m0_net_buffer_event *evt)
 
M0_INTERNAL int ioreq_fop_async_submit (struct m0_io_fop *iofop, struct m0_rpc_session *session)
 
static void ioreq_pgiomap_find (struct m0_op_io *ioo, uint64_t grpid, uint64_t *cursor, struct pargrp_iomap **out)
 
M0_INTERNAL int ioreq_fop_dgmode_read (struct ioreq_fop *irfop)
 
static void ioreq_cc_fop_release (struct m0_ref *ref)
 
M0_INTERNAL int ioreq_cc_fop_init (struct target_ioreq *ti)
 
static void ioreq_fop_release (struct m0_ref *ref)
 
M0_INTERNAL int ioreq_fop_init (struct ioreq_fop *fop, struct target_ioreq *ti, enum page_attr pattr)
 
M0_INTERNAL void ioreq_fop_fini (struct ioreq_fop *fop)
 

Variables

struct m0_bob_type iofop_bobtype
 
static const struct m0_rpc_item_ops item_ops
 
static const struct m0_rpc_item_ops cc_item_ops
 
const struct m0_net_buffer_callbacks client__buf_bulk_cb
 

Macro Definition Documentation

◆ LOGMSG

#define LOGMSG (   ioo,
  rc,
  tireq 
)
Value:
"ioo=%p from=%s rc=%d ti_rc=%d @"FID_F,\
(ioo), m0_rpc_conn_addr((tioreq)->ti_session->s_conn),\
(rc), (tioreq)->ti_rc, FID_P(&(tioreq)->ti_fid)
M0_INTERNAL const char * m0_rpc_conn_addr(const struct m0_rpc_conn *conn)
Definition: conn.c:1306
#define FID_P(f)
Definition: fid.h:77
int32_t rc
Definition: trigger_fop.h:47
#define FID_F
Definition: fid.h:75

◆ M0_TRACE_SUBSYSTEM

#define M0_TRACE_SUBSYSTEM   M0_TRACE_SUBSYS_CLIENT

Definition at line 40 of file io_req_fop.c.

Function Documentation

◆ application_attribute_copy()

static void application_attribute_copy ( struct m0_indexvec rep_ivec,
struct target_ioreq ti,
struct m0_op_io ioo,
struct m0_buf buf 
)
static

Copies correct part of attribute buffer to client's attribute bufvec. received from reply fop.

| CS0 | CS1 | CS2 | CS3 | CS4 | CS5 | CS6 |
  1. rep_ivec* will be COB offset received from target | rep_index[0] || rep_index[1] || rep_index[2] |
  2. ti_ivec will be COB offset while sending | ti_index[0] || ti_index[1] || ti_index[2] || ti_index[3] | *Note: rep_ivec will be subset of ti_ivec
  3. ti_goff_ivec will be GOB offset while sending Note: rep_ivec will be subset of ti_ivec

Steps:

  1. Bring reply ivec to start of unit
  2. Then move cursor of ti_vec so that it matches rep_ivec start. Move the ti_goff_ivec for by the same size Note: This will make all vec aligned
  3. Then iterate over rep_ivec one unit at a time till we process all extents, get corresponding GOB offset and use GOB Offset and GOB Extents (ioo_ext) to locate the checksum add and copy one checksum to the application checksum buffer.
    Parameters
    rep_ivecm0_indexvec representing the extents spanned by IO.
    titarget_ioreq structure for this reply's taregt.
    iooObject's context for client's internal workings.
    bufbuffer contaiing attributes received from server.

Cursor iterating over segments spanned by this IO. At each iteration index of reply fop is matched with all the target offsets stored in target_ioreq::ti_ivec, once matched, the checksum offset is retrieved from target_ioreq::ti_goff_ivec for the corresponding target offset.

The checksum offset represents the correct segemnt of m0_op_io::ioo_attr which needs to be populated for the current target offset(represented by rep_index).

Definition at line 134 of file io_req_fop.c.

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

◆ client_passive_recv()

static void client_passive_recv ( const struct m0_net_buffer_event evt)
static

Callback for the rpc layer when it receives a completed bulk transfer. This is heavily based on m0t1fs/linux_kernel/file.cclient_passive_recv

Parameters
evtA network event summary from the rpc layer.

Definition at line 593 of file io_req_fop.c.

Here is the call graph for this function:

◆ io_bottom_half()

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

AST-Callback for the rpc layer when it receives a reply fop. This is heavily based on m0t1fs/linux_kernel/file.cio_bottom_half

Parameters
grpThe state-machine-group/locality that is processing this callback.
astThe AST that triggered this callback, used to find the IO operation.

Definition at line 246 of file io_req_fop.c.

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

◆ io_rpc_item_cb()

static void io_rpc_item_cb ( struct m0_rpc_item item)
static

Callback for the rpc layer when it receives a reply fop. This schedules io_bottom_half. This is heavily based on m0t1fs/linux_kernel/file.cio_rpc_item_cb

Parameters
itemThe rpc item for which a reply was received.

Definition at line 419 of file io_req_fop.c.

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

◆ ioreq_cc_bottom_half()

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

Definition at line 458 of file io_req_fop.c.

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

◆ ioreq_cc_fop_init()

M0_INTERNAL int ioreq_cc_fop_init ( struct target_ioreq ti)

Initialises cob create fop. It's required for those targets that are not part of io request, but host the members of at least one parity group that's spanned by io request.

Definition at line 810 of file io_req_fop.c.

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

◆ ioreq_cc_fop_release()

static void ioreq_cc_fop_release ( struct m0_ref ref)
static

Definition at line 800 of file io_req_fop.c.

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

◆ ioreq_cc_rpc_item_cb()

static void ioreq_cc_rpc_item_cb ( struct m0_rpc_item item)
static

Definition at line 532 of file io_req_fop.c.

Here is the call graph for this function:

◆ ioreq_fop_async_submit()

M0_INTERNAL int ioreq_fop_async_submit ( struct m0_io_fop iofop,
struct m0_rpc_session session 
)

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

Definition at line 672 of file io_req_fop.c.

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

◆ ioreq_fop_dgmode_read()

M0_INTERNAL int ioreq_fop_dgmode_read ( struct ioreq_fop irfop)

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

Definition at line 745 of file io_req_fop.c.

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

◆ ioreq_fop_fini()

M0_INTERNAL void ioreq_fop_fini ( struct ioreq_fop fop)

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

Definition at line 1036 of file io_req_fop.c.

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

◆ ioreq_fop_init()

M0_INTERNAL int ioreq_fop_init ( struct ioreq_fop fop,
struct target_ioreq ti,
enum page_attr  pattr 
)

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

Definition at line 977 of file io_req_fop.c.

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

◆ ioreq_fop_invariant()

M0_INTERNAL bool ioreq_fop_invariant ( const struct ioreq_fop fop)

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

Definition at line 62 of file io_req_fop.c.

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

◆ ioreq_fop_release()

static void ioreq_fop_release ( struct m0_ref ref)
static

Releases an io fop, freeing the network buffers. This is heavily based on m0t1fs/linux_kernel/file.cio_req_fop_release

Parameters
refA fop reference to release.

Definition at line 886 of file io_req_fop.c.

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

◆ ioreq_pgiomap_find()

static void ioreq_pgiomap_find ( struct m0_op_io ioo,
uint64_t  grpid,
uint64_t *  cursor,
struct pargrp_iomap **  out 
)
static

Definition at line 718 of file io_req_fop.c.

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

◆ M0_BOB_DEFINE()

M0_BOB_DEFINE ( M0_INTERNAL  ,
iofop_bobtype,
ioreq_fop   
)

◆ m0_client_fop_to_file()

M0_INTERNAL struct m0_file* m0_client_fop_to_file ( struct m0_fop fop)

Definition at line 88 of file io_req_fop.c.

Here is the caller graph for this function:

◆ m0_sm_io_done_ast()

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

Definition at line 572 of file io_req_fop.c.

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

◆ M0_TL_DEFINE()

M0_TL_DEFINE ( iofops  ,
M0_INTERNAL  ,
struct ioreq_fop   
)

◆ M0_TL_DESCR_DEFINE()

M0_TL_DESCR_DEFINE ( iofops  ,
"List of IO fops"  ,
M0_INTERNAL  ,
struct ioreq_fop  ,
irf_link  ,
irf_magic  ,
M0_IOFOP_MAGIC  ,
M0_TIOREQ_MAGIC   
)

Definition for a list of io fops, used to group fops that belong to the same client:operation

◆ should_ioreq_sm_complete()

static bool should_ioreq_sm_complete ( struct m0_op_io ioo)
static

Definition at line 71 of file io_req_fop.c.

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

Variable Documentation

◆ cc_item_ops

const struct m0_rpc_item_ops cc_item_ops
static
Initial value:
= {
.rio_replied = ioreq_cc_rpc_item_cb,
}
static void ioreq_cc_rpc_item_cb(struct m0_rpc_item *item)
Definition: io_req_fop.c:532

Definition at line 567 of file io_req_fop.c.

◆ client__buf_bulk_cb

const struct m0_net_buffer_callbacks client__buf_bulk_cb
Initial value:
= {
.nbc_cb = {
}
}
M0_INTERNAL void m0_rpc_bulk_default_cb(const struct m0_net_buffer_event *evt)
Definition: bulk.c:140
static void client_passive_recv(const struct m0_net_buffer_event *evt)
Definition: io_req_fop.c:593

Callbacks for the RPC layer to inform client of events

Definition at line 660 of file io_req_fop.c.

◆ iofop_bobtype

struct m0_bob_type iofop_bobtype

Definition at line 47 of file io_req_fop.c.

◆ item_ops

const struct m0_rpc_item_ops item_ops
static
Initial value:
= {
.rio_replied = io_rpc_item_cb,
}
static void io_rpc_item_cb(struct m0_rpc_item *item)
Definition: io_req_fop.c:419

Definition at line 563 of file io_req_fop.c.