Motr  M0
fsync_fops.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2014-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 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_COB
23 #include "mdservice/fsync_foms.h"
24 #include "mdservice/fsync_fops.h"
25 #include "mdservice/fsync_fops_xc.h"
26 #include "rpc/rpc_opcodes.h"
27 #include "lib/trace.h"
28 #include "fop/fom_generic.h" /* m0_generic_conf */
29 
34 
40 
44 M0_INTERNAL void m0_mdservice_fsync_fop_fini(void)
45 {
47 
49 
50 #ifndef __KERNEL__
52 #endif
53 }
54 M0_EXPORTED(m0_mdservice_fsync_fop_fini);
55 
56 #ifndef __KERNEL__
57 
64 };
65 
66 
67 static void fop_init(struct m0_reqh_service_type * svct)
68 {
69  M0_ASSERT(svct != NULL);
70 
71  /* extend m0_fsync_fom_conf with the generic phases */
74 
76 
78 
80  .name = "fsync-mds request",
82  .xt = m0_fop_fsync_xc,
83  .rpc_flags = M0_RPC_ITEM_TYPE_REQUEST,
84  .fom_ops = &m0_fsync_fom_ops,
85  /*
86  * The fsync fopt is initialize with the svct of the
87  * first service calling this function.
88  */
89  .svc_type = svct,
90  .sm = &m0_fsync_fom_conf);
91 }
92 
93 #else /* __KERNEL__ */
94 
95 static void fop_init(__attribute__((unused)) struct m0_reqh_service_type * svct)
96 {
98  .name = "fsync-mds request",
100  .xt = m0_fop_fsync_xc,
101  .rpc_flags = M0_RPC_ITEM_TYPE_REQUEST);
102 }
103 
104 M0_EXPORTED(m0_mdservice_fsync_fop_init);
105 
106 #endif
107 
108 
113 M0_INTERNAL int m0_mdservice_fsync_fop_init(struct m0_reqh_service_type * svct)
114 {
115  fop_init(svct);
116 
118  .name = "fsync reply",
120  .xt = m0_fop_fsync_rep_xc,
121  .rpc_flags = M0_RPC_ITEM_TYPE_REPLY);
122  return M0_RC(0);
123 }
124 
125 
126 #undef M0_TRACE_SUBSYSTEM
127 /*
128  * Local variables:
129  * c-indentation-style: "K&R"
130  * c-basic-offset: 8
131  * tab-width: 8
132  * fill-column: 80
133  * scroll-step: 1
134  * End:
135  */
M0_INTERNAL void m0_sm_conf_init(struct m0_sm_conf *conf)
Definition: sm.c:340
#define NULL
Definition: misc.h:38
struct m0_fop_type m0_fop_fsync_rep_fopt
Definition: fsync_fops.c:39
#define M0_FOP_TYPE_INIT(ft,...)
Definition: fop.h:307
int(* fto_create)(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: fom.h:650
enum m0_md_lustre_logrec_type __attribute__
Definition: balloc.c:2745
void m0_fop_type_fini(struct m0_fop_type *fopt)
Definition: fop.c:232
M0_INTERNAL void m0_sm_conf_trans_extend(const struct m0_sm_conf *base, struct m0_sm_conf *sub)
Definition: sm.c:726
M0_INTERNAL void m0_sm_conf_extend(const struct m0_sm_state_descr *base, struct m0_sm_state_descr *sub, uint32_t nr)
Definition: sm.c:763
static struct m0_xcode_type ** xt[]
Definition: protocol.c:64
struct m0_sm_state_descr m0_fsync_fom_phases[]
Definition: fsync_foms.c:69
struct m0_fop_type m0_fop_fsync_mds_fopt
Definition: fsync_fops.c:33
const struct m0_sm_conf m0_generic_conf
Definition: fom_generic.c:838
static void fop_init(struct m0_reqh_service_type *svct)
Definition: fsync_fops.c:67
M0_INTERNAL int m0_fsync_req_fom_create(struct m0_fop *fop, struct m0_fom **out, struct m0_reqh *reqh)
Definition: fsync_foms.c:330
return M0_RC(rc)
M0_INTERNAL struct m0_sm_conf m0_fsync_fom_conf
Definition: fsync_foms.c:123
const struct m0_fom_type_ops m0_fsync_fom_ops
Definition: fsync_fops.c:62
int opcode
Definition: crate.c:301
const char * name
Definition: trace.c:110
M0_INTERNAL int m0_mdservice_fsync_fop_init(struct m0_reqh_service_type *svct)
Definition: fsync_fops.c:113
#define M0_ASSERT(cond)
uint32_t scf_nr_states
Definition: sm.h:354
struct m0_sm_state_descr * scf_state
Definition: sm.h:356
M0_INTERNAL void m0_sm_conf_fini(struct m0_sm_conf *conf)
Definition: sm.c:376
M0_INTERNAL void m0_mdservice_fsync_fop_fini(void)
Definition: fsync_fops.c:44