Motr  M0
sync.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2017-2020 Seagate Technology LLC and/or its Affiliates
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * For any questions about this software or licensing,
18  * please email opensource@seagate.com or cortx-questions@seagate.com.
19  *
20  */
21 
22 
23 #include "mdservice/fsync_fops.h" /* m0_fop_fsync_mds_fopt */
24 #include "cas/cas.h" /* m0_fop_fsync_cas_fopt */
25 #include "fop/fop.h" /* m0_fop */
26 
27 #pragma once
28 
29 #ifndef __MOTR_OSYNC_H__
30 #define __MOTR_OSYNC_H__
31 
38 /* import */
39 struct m0_obj;
40 struct m0_op_sync;
41 struct m0_reqh_service_ctx;
42 
43 M0_TL_DESCR_DECLARE(spti, M0_EXTERN);
44 M0_TL_DECLARE(spti, M0_EXTERN, struct m0_reqh_service_txid);
45 
46 enum sync_type {
50 };
51 
55 struct sync_target {
56  uint32_t srt_type;
57  union {
58  struct m0_entity *srt_ent;
59  struct m0_op *srt_op;
60  } u;
61 
62  /* Link to an SYNC request list. */
64  uint64_t srt_tlink_magic;
65 };
66 
67 struct sync_request {
68  /* Back pointer to sync_op. */
70 
72  struct m0_tl sr_targets;
73 
76  struct m0_tl sr_stxs;
77 
84  struct m0_tl sr_fops;
85  int32_t sr_nr_fops;
86 
87 
88  /* Post an AST when all fops of this SYNC request are done. */
89  struct m0_sm_ast sr_ast;
90 
91  int32_t sr_rc;
92 };
93 
101  struct m0_fop sfw_fop;
102 
110 
112 
113  /* AST to handle when receiving reply fop. */
115 
116  /* Link to FSYNC fop list in a request. */
118  uint64_t sfw_tlink_magic;
119 };
120 
129  void (*si_fop_fini)(struct m0_fop *fop);
130  void (*si_fop_put)(struct m0_fop *fop);
131 };
132 
138 M0_INTERNAL void
140  struct m0_entity *obj,
141  struct m0_op *op,
142  struct m0_be_tx_remid *btr);
143 
149 M0_INTERNAL struct m0_entity *
150 m0__op_sync_entity(const struct m0_op *op);
151 
152 #endif /* __MOTR_OSYNC_H__ */
153 
154 /*
155  * Local variables:
156  * c-indentation-style: "K&R"
157  * c-basic-offset: 8
158  * tab-width: 8
159  * fill-column: 80
160  * scroll-step: 1
161  * End:
162  */
struct m0_sm_ast sfw_ast
Definition: sync.h:114
struct m0_mutex sr_stxs_lock
Definition: sync.h:75
struct m0_fop sfw_fop
Definition: sync.h:101
Definition: client.h:788
struct m0_sm_ast sr_ast
Definition: sync.h:89
struct m0_tl sr_stxs
Definition: sync.h:76
uint64_t srt_tlink_magic
Definition: sync.h:64
int32_t sr_rc
Definition: sync.h:91
M0_INTERNAL void sync_record_update(struct m0_reqh_service_ctx *service, struct m0_entity *obj, struct m0_op *op, struct m0_be_tx_remid *btr)
Definition: sync.c:788
uint64_t m0_time_t
Definition: time.h:37
uint32_t srt_type
Definition: sync.h:56
struct m0_reqh_service_txid * sfw_stx
Definition: sync.h:109
Definition: sm.h:504
static struct m0_rpc_item * item
Definition: item.c:56
static struct foo * obj
Definition: tlist.c:302
op
Definition: libdemo.c:64
struct m0_entity * srt_ent
Definition: sync.h:58
Definition: client.h:641
void(* si_fop_fini)(struct m0_fop *fop)
Definition: sync.h:129
Definition: tlist.h:251
int(* si_post_rpc)(struct m0_rpc_item *item)
Definition: sync.h:127
M0_TL_DECLARE(spti, M0_EXTERN, struct m0_reqh_service_txid)
struct m0_tlink srt_tlink
Definition: sync.h:63
Definition: sync.h:48
struct m0_tl sr_targets
Definition: sync.h:72
struct m0_op * srt_op
Definition: sync.h:59
struct sync_request * sfw_req
Definition: sync.h:111
static uint32_t timeout
Definition: console.c:52
M0_TL_DESCR_DECLARE(spti, M0_EXTERN)
uint64_t sfw_tlink_magic
Definition: sync.h:118
struct m0_tlink sfw_tlink
Definition: sync.h:117
struct m0_op_sync * sr_op_sync
Definition: sync.h:69
int(* si_wait_for_reply)(struct m0_rpc_item *item, m0_time_t timeout)
Definition: sync.h:128
sync_type
Definition: sync.h:46
void(* si_fop_put)(struct m0_fop *fop)
Definition: sync.h:130
static struct m0_fop * fop
Definition: item.c:57
int32_t sr_nr_fops
Definition: sync.h:85
struct m0_tl sr_fops
Definition: sync.h:84
Definition: mutex.h:47
M0_INTERNAL struct m0_entity * m0__op_sync_entity(const struct m0_op *op)
Definition: sync.c:1172
static struct m0_reqh_service * service[REQH_IN_UT_MAX]
Definition: long_lock_ut.c:46
union sync_target::@361 u
struct m0_mutex sr_fops_lock
Definition: sync.h:83
Definition: fop.h:79