Motr
M0
|
#include "motr/client.h"
#include "motr/client_internal.h"
#include "motr/addb.h"
#include "motr/pg.h"
#include "motr/io.h"
#include "lib/memory.h"
#include "lib/errno.h"
#include "lib/finject.h"
#include "lib/cksum_utils.h"
#include "fid/fid.h"
#include "rpc/rpclib.h"
#include "lib/ext.h"
#include "lib/misc.h"
#include "fop/fom_generic.h"
#include "sns/parity_repair.h"
#include "fd/fd.h"
#include "rpc/item.h"
#include "rpc/rpc_internal.h"
#include "lib/trace.h"
Go to the source code of this file.
Macros | |
#define | M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT |
Functions | |
M0_BOB_DEFINE (M0_INTERNAL, &nwxfer_bobtype, nw_xfer_request) | |
M0_BOB_DEFINE (M0_INTERNAL, &tioreq_bobtype, target_ioreq) | |
static void | to_op_io_map (const struct m0_op *op, struct m0_op_io *ioo) |
static void | m0_op_io_to_rpc_map (const struct m0_op_io *ioo, const struct m0_rpc_item *item) |
static uint32_t | io_di_size (struct m0_op_io *ioo) |
static void | parity_page_pos_get (struct pargrp_iomap *map, m0_bindex_t index, uint32_t *row, uint32_t *col) |
static int | dgmode_rwvec_alloc_init (struct target_ioreq *ti) |
static void | dgmode_rwvec_dealloc_fini (struct dgmode_rwvec *dg) |
static uint64_t | tioreqs_hash_func (const struct m0_htable *htable, const void *k) |
static bool | tioreq_key_eq (const void *key1, const void *key2) |
M0_HT_DESCR_DEFINE (tioreqht, "Hash of target_ioreq objects", M0_INTERNAL, struct target_ioreq, ti_link, ti_magic, M0_TIOREQ_MAGIC, M0_TLIST_HEAD_MAGIC, ti_fid.f_container, tioreqs_hash_func, tioreq_key_eq) | |
M0_HT_DEFINE (tioreqht, M0_INTERNAL, struct target_ioreq, uint64_t) | |
static bool | target_ioreq_invariant (const struct target_ioreq *ti) |
M0_INTERNAL bool | nw_xfer_request_invariant (const struct nw_xfer_request *xfer) |
void | target_ioreq_fini (struct target_ioreq *ti) |
void | target_ioreq_cancel (struct target_ioreq *ti) |
static struct target_ioreq * | target_ioreq_locate (struct nw_xfer_request *xfer, struct m0_fid *fid) |
static bool | should_unit_be_truncated (bool partial, enum m0_pdclust_unit_type unit_type, enum page_attr flags) |
static void | target_ioreq_seg_add (struct target_ioreq *ti, const struct m0_pdclust_src_addr *src, const struct m0_pdclust_tgt_addr *tgt, m0_bindex_t gob_offset, m0_bcount_t count, struct pargrp_iomap *map) |
M0_INTERNAL struct m0_fid | target_fid (struct m0_op_io *ioo, struct m0_pdclust_tgt_addr *tgt) |
static struct m0_rpc_session * | target_session (struct m0_op_io *ioo, struct m0_fid tfid) |
static int | bulk_buffer_add (struct ioreq_fop *irfop, struct m0_net_domain *dom, struct m0_rpc_bulk_buf **rbuf, uint32_t *delta, uint32_t maxsize) |
static void | irfop_fini (struct ioreq_fop *irfop) |
static void * | buf_aux_chk_get (struct m0_bufvec *aux, enum page_attr p_attr, uint32_t seg_idx, bool rd_in_wr) |
static int | target_ioreq_iofops_prepare (struct target_ioreq *ti, enum page_attr filter) |
static int | target_cob_fop_prepare (struct target_ioreq *ti) |
static int | target_ioreq_init (struct target_ioreq *ti, struct nw_xfer_request *xfer, const struct m0_fid *cobfid, uint64_t ta_obj, struct m0_rpc_session *session, uint64_t size) |
static int | nw_xfer_tioreq_get (struct nw_xfer_request *xfer, struct m0_fid *fid, uint64_t ta_obj, struct m0_rpc_session *session, uint64_t size, struct target_ioreq **out) |
static void | databufs_set_dgw_mode (struct pargrp_iomap *iomap, struct m0_pdclust_layout *play, struct m0_ext *ext) |
static void | paritybufs_set_dgw_mode (struct pargrp_iomap *iomap, struct m0_op_io *ioo, uint64_t unit) |
static int | nw_xfer_io_distribute (struct nw_xfer_request *xfer) |
static void | nw_xfer_req_complete (struct nw_xfer_request *xfer, bool rmw) |
static int | nw_xfer_req_dispatch (struct nw_xfer_request *xfer) |
static bool | should_spare_be_mapped (struct m0_op_io *ioo, enum m0_pool_nd_state dev_state) |
static int | nw_xfer_tioreq_map (struct nw_xfer_request *xfer, const struct m0_pdclust_src_addr *src, struct m0_pdclust_tgt_addr *tgt, struct target_ioreq **tio) |
M0_INTERNAL void | nw_xfer_request_init (struct nw_xfer_request *xfer) |
M0_INTERNAL void | nw_xfer_request_fini (struct nw_xfer_request *xfer) |
Variables | |
const struct m0_bob_type | nwxfer_bobtype |
const struct m0_bob_type | tioreq_bobtype |
static const struct target_ioreq_ops | tioreq_ops |
static const struct nw_xfer_ops | xfer_ops |
#define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_CLIENT |
Definition at line 44 of file io_nw_xfer.c.
|
static |
Helper function which will return the buffer address based on the page attr, fop phase and aux bufvec.
Definition at line 827 of file io_nw_xfer.c.
|
static |
Pair data/parity buffers with the io fop rpc. This is heavily based on m0t1fs/linux_kernel/file.ctarget_ioreq_iofops_prepare
irfop | The io fop that needs bulk buffers adding. |
dom | The network domain this rpc will be sent in. |
rbuf[out] | The rpc bulk buffer that contains the target-iorequest's extents. |
delta[out] | The extra space in the fop needed for metadata. |
maxsize | Caller provided limit. |
Definition at line 760 of file io_nw_xfer.c.
|
static |
Sets databufs within a data unit to the degraded write mode. The unit boundary is ensured by the calling code at nw_xfer_io_distribute().
Definition at line 1406 of file io_nw_xfer.c.
|
static |
Allocates an index and buffer vector(in structure dgmode_rwvec) for a degraded mode IO. This is heavily based on m0t1fs/linux_kernel/file.cdgmode_rwvec_alloc_init
ti | The target_ioreq fop asking for the allocation. |
Definition at line 151 of file io_nw_xfer.c.
|
static |
Free index and buffer vector stored in structure dgmode_rwvec for a degraded mode IO. This is heavily based on m0t1fs/linux_kernel/file.cdgmode_rwvec_dealloc_fini
dg | The dgmode_rwvec to be finalised. |
Definition at line 244 of file io_nw_xfer.c.
|
static |
Calculate the size needed for per-segment on-wire data integrity. Note: Client leaves its applications to decide how to use locks on objects, so it doesn't manage any lock. But file lock is needed to calculate di size, a file lock is faked here to get di details. Clearly, a more reliable way to get di size is needed.
ioo | The IO operation, to find the client instance. |
Definition at line 98 of file io_nw_xfer.c.
|
static |
Finalises an io request fop, (releases bulk buffers). This is heavily based on m0t1fs/linux_kernel/file.cirfop_fini
irfop | The io request fop to finalise. |
Definition at line 810 of file io_nw_xfer.c.
M0_BOB_DEFINE | ( | M0_INTERNAL | , |
& | nwxfer_bobtype, | ||
nw_xfer_request | |||
) |
BOB definitions for the assorted parts of io requests and nwxfer
M0_BOB_DEFINE | ( | M0_INTERNAL | , |
& | tioreq_bobtype, | ||
target_ioreq | |||
) |
M0_HT_DEFINE | ( | tioreqht | , |
M0_INTERNAL | , | ||
struct target_ioreq | , | ||
uint64_t | |||
) |
M0_HT_DESCR_DEFINE | ( | tioreqht | , |
"Hash of target_ioreq objects" | , | ||
M0_INTERNAL | , | ||
struct target_ioreq | , | ||
ti_link | , | ||
ti_magic | , | ||
M0_TIOREQ_MAGIC | , | ||
M0_TLIST_HEAD_MAGIC | , | ||
ti_fid. | f_container, | ||
tioreqs_hash_func | , | ||
tioreq_key_eq | |||
) |
|
static |
Definition at line 80 of file io_nw_xfer.c.
|
static |
Distributes file data into target_ioreq objects as required and populates target_ioreq::ti_ivec and target_ioreq::ti_bufvec. This is heavily based on m0t1fs/linux_kernel/file.cnw_xfer_io_distribute
xfer | The network transfer request. |
Definition at line 1460 of file io_nw_xfer.c.
|
static |
Completes all the target io requests in a network transfer request. Collects the total number of bytes read/written, and determines the final return code. This is heavily based on m0t1fs/linux_kernel/file.cnw_xfer_req_complete Call with ioo->ioo_sm.sm_grp locked.
xfer | The network transfer request. |
rmw | Whether this request was part of a multiple requests (rmw). |
XXX morse: there are better ways of determining whether this is a read request
Definition at line 1667 of file io_nw_xfer.c.
|
static |
Prepares each target io request in the network transfer requests, and submit the fops. This is heavily based on m0t1fs/linux_kernel/file.cnw_xfer_req_dispatch
xfer | The network transfer request. |
Definition at line 1795 of file io_nw_xfer.c.
M0_INTERNAL void nw_xfer_request_fini | ( | struct nw_xfer_request * | xfer | ) |
Finalises a network transfer request. This is heavily based on m0t1fs/linux_kernel/file.cnw_xfer_request_fini
xfer[out] | The network transfer request to finalise. |
Definition at line 2159 of file io_nw_xfer.c.
M0_INTERNAL void nw_xfer_request_init | ( | struct nw_xfer_request * | xfer | ) |
Initialises a network transfer request. This is heavily based on m0t1fs/linux_kernel/file.cnw_xfer_request_init
xfer[out] | The network transfer request to initialise. |
Definition at line 2130 of file io_nw_xfer.c.
M0_INTERNAL bool nw_xfer_request_invariant | ( | const struct nw_xfer_request * | xfer | ) |
This is heavily based on m0t1fs/linux_kernel/file.cnw_xfer_request_invariant
Definition at line 340 of file io_nw_xfer.c.
|
static |
Retrieves (possibly allocating and initialising) a target io request for the provided network transfer requests. This is heavily based on m0t1fs/linux_kernel/file.cnw_xfer_tioreq_get
xfer | The network transfer. |
fid | The cob fid that the request will operate on. |
ta_obj | Which object in the global layout the cobfid corresponds to. |
session | The session the request will be sent on. |
size | The size of the request. |
out[out] | The discovered (or allocated) target io request. |
Definition at line 1351 of file io_nw_xfer.c.
|
static |
Determines which targets (spare or not) of the io map the network transfer requests should be mapped to. This is heavily based on m0t1fs/linux_kernel/file.cnw_xfer_tioreq_map
xfer | The network transfer request. |
src | unit address in the parity groups. |
tgt[out] | unit address in the target devices. |
tio[out] | The retrieved (or allocated) target request. |
Definition at line 2027 of file io_nw_xfer.c.
|
static |
Definition at line 124 of file io_nw_xfer.c.
|
static |
Sets paritybufs for the parity to the degraded write mode.
Definition at line 1431 of file io_nw_xfer.c.
|
static |
should_spare_be_mapped() decides whether given IO request should be redirected to the spare unit device or not.
For normal IO, M0_IN(ioreq_sm_state, (IRS_READING, IRS_WRITING)), such redirection is not needed, with the exception of read IO case when the failed device is in REPAIRED state.
Note: req->ir_sns_state is used only to differentiate between two possible use cases during the degraded mode write.
Here are possible combinations of different parameters on which the decision is made.
Input parameters:
Degraded read case (IRS_DEGRADED_READING):
device_state == M0_PNDS_SNS_REPAIRING
Not redirected. The extent is assigned to the failed device itself but it is filtered at the level of io_req_fop.
device_state == M0_PNDS_SNS_REPAIRED
Redirected.
Degraded write case (IRS_DEGRADED_WRITING):
device_state == M0_PNDS_SNS_REPAIRED
Redirected.
device_state == M0_PNDS_SNS_REPAIRING && req->ir_sns_state == SRS_REPAIR_DONE
Redirected. Repair is finished for the current global fid.
device_state == M0_PNDS_SNS_REPAIRING && req->ir_sns_state == SRS_REPAIR_NOTDONE
Not redirected. Repair is not finished for this global fid yet. So we just drop all pages directed towards the failed device. The data will be restored by SNS-repair in the due time later.
device_state == M0_PNDS_SNS_REPAIRED && req->ir_sns_state == SRS_REPAIR_NOTDONE
This should not be possible.
Definition at line 2002 of file io_nw_xfer.c.
|
static |
|
static |
M0_INTERNAL struct m0_fid target_fid | ( | struct m0_op_io * | ioo, |
struct m0_pdclust_tgt_addr * | tgt | ||
) |
This is heavily based on m0t1fs/linux_kernel/file.ctarget_fid().
Definition at line 710 of file io_nw_xfer.c.
void target_ioreq_cancel | ( | struct target_ioreq * | ti | ) |
Cancel a target_ioreq.
ti | The target_ioreq to cancel. |
Definition at line 423 of file io_nw_xfer.c.
void target_ioreq_fini | ( | struct target_ioreq * | ti | ) |
This is heavily based on m0t1fs/linux_kernel/file.ctarget_ioreq_fini
Definition at line 364 of file io_nw_xfer.c.
|
static |
Initialises a target io request. This is heavily based on m0t1fs/linux_kernel/file.ctarget_ioreq_init
ti[out] | The target io request to initialise. |
xfer | The corresponding network transfer request. |
cobfid | The fid of the cob this request will act on. |
ta_obj | Which object in the global layout the cobfid corresponds to. |
session | The rpc session that should be used to send this request. |
size | The size of the request in bytes. |
Definition at line 1195 of file io_nw_xfer.c.
|
static |
Checks a target_ioreq struct is correct. This is heavily based on m0t1fs/linux_kernel/file.ctarget_ioreq_invariant
ti | The target_ioreq fop to check. |
Definition at line 324 of file io_nw_xfer.c.
|
static |
Assembles io fops for the specified target server. This is heavily based on m0t1fs/linux_kernel/file.ctarget_ioreq_iofops_prepare
ti | The target io request whose data/parity fops should be assembled. |
filter | Whether to restrict the set of fops to prepare. |
Definition at line 843 of file io_nw_xfer.c.
|
static |
This is heavily based on m0t1fs/linux_kernel/file.ctarget_ioreq_locate
Definition at line 435 of file io_nw_xfer.c.
|
static |
Adds an io segment to index vector and buffer vector in target_ioreq structure. This is heavily based on m0t1fs/linux_kernel/file.ctarget_ioreq_seg_add
ti | The target io request. |
src | Where in the global file the io occurs. |
tgt | Where in the target servers 'tile' the io occurs. |
gob_offset | Offset in the global file. |
count | Number of bytes in this operation. |
map | Map of data/parity buffers, used to tie ti to the corresponding buffers. |
CKSUM_TODO: Need to handle degraded write cksum update
Ignore hole because of data size not alligned pool width
Storing the values of goff(checksum offset) into the goff_ivec according to target offset. This creates a mapping between target offset and cheksum offset.
This mapping will be used when we get read reply FOP to locae the checksum in application provided buffer
Definition at line 479 of file io_nw_xfer.c.
|
inlinestatic |
Finds the rpc session to use to contact the server hosting a particular target:fid (cob). This is heavily based on m0t1fs/linux_kernel/file.ctarget_session
ioo | The IO operation. |
tfid | The cob fid to look for. |
a | pointer to the rpc_session to use to contact this target. |
Definition at line 731 of file io_nw_xfer.c.
|
static |
Compares keys for target-io requets. This is heavily based on m0t1fs/linux_kernel/file.ctioreq_key_eq.
key1 | The key of the first target-io request. |
key2 | The key of the second target-io request. |
Definition at line 299 of file io_nw_xfer.c.
|
static |
Generates a hash for a target-io request. This is heavily based on m0t1fs/linux_kernel/file.ctioreqs_hash_func.
htable | The hash table in use. |
k | Pointer to the key of the entry to hash. |
Definition at line 279 of file io_nw_xfer.c.
Definition at line 70 of file io_nw_xfer.c.
const struct m0_bob_type nwxfer_bobtype |
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 48 of file io_nw_xfer.c.
const struct m0_bob_type tioreq_bobtype |
Definition at line 49 of file io_nw_xfer.c.
|
static |
Definition at line 1167 of file io_nw_xfer.c.
|
static |
Definition at line 2123 of file io_nw_xfer.c.