Motr  M0
cm.c
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2016-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 
30 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_DIXCM
31 #include "dix/cm/cp.h"
32 #include "dix/cm/cm.h"
33 #include "lib/trace.h"
34 #include "cm/repreb/cm.h"
35 #include "layout/pdclust.h"
36 
37 M0_INTERNAL
39  void (*fop_release)(struct m0_ref *),
40  uint64_t proxy_id, const char *local_ep,
41  const struct m0_cm_sw *sw,
42  const struct m0_cm_sw *out_interval);
43 
44 M0_INTERNAL int m0_dix_cm_ag_alloc(struct m0_cm *cm,
45  const struct m0_cm_ag_id *id,
46  bool has_incoming,
47  struct m0_cm_aggr_group **out);
48 
49 static int dix_repair_cm_prepare(struct m0_cm *cm)
50 {
51  struct m0_dix_cm *dcm = cm2dix(cm);
52 
53  M0_ENTRY("cm: %p", cm);
55  return 0;
56 }
57 
58 static struct m0_cm_cp *dix_repair_cm_cp_alloc(struct m0_cm *cm)
59 {
60  struct m0_cm_cp *cp;
61 
62  cp = m0_dix_cm_cp_alloc(cm);
63  if (cp != NULL)
65  return cp;
66 }
67 
68 static void dix_repair_cm_stop(struct m0_cm *cm)
69 {
70  struct m0_dix_cm *dcm = cm2dix(cm);
71 
72  M0_ENTRY();
75  M0_LEAVE();
76 }
77 
79 const struct m0_cm_ops dix_repair_ops = {
81  .cmo_prepare = dix_repair_cm_prepare,
82  .cmo_start = m0_dix_cm_start,
83  .cmo_ag_alloc = m0_dix_cm_ag_alloc,
84  .cmo_cp_alloc = dix_repair_cm_cp_alloc,
85  .cmo_data_next = m0_dix_cm_data_next,
86  .cmo_ag_next = m0_dix_cm_ag_next,
87  .cmo_get_space_for = m0_dix_get_space_for,
88  .cmo_sw_onwire_fop_setup = m0_dix_repair_sw_onwire_fop_setup,
89  .cmo_is_peer = m0_dix_is_peer,
90  .cmo_stop = dix_repair_cm_stop,
91  .cmo_fini = m0_dix_cm_fini
92 };
93 
94 
95 #undef M0_TRACE_SUBSYSTEM
96 
99 /*
100  * Local variables:
101  * c-indentation-style: "K&R"
102  * c-basic-offset: 8
103  * tab-width: 8
104  * fill-column: 80
105  * scroll-step: 1
106  * End:
107  */
108 /*
109  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
110  */
M0_INTERNAL struct m0_dix_cm * cm2dix(struct m0_cm *cm)
Definition: cm.c:308
static struct m0_cm_cp * dix_repair_cm_cp_alloc(struct m0_cm *cm)
Definition: cm.c:58
#define M0_PRE(cond)
Definition: sw.h:45
#define NULL
Definition: misc.h:38
M0_EXTERN const struct m0_cm_cp_ops m0_dix_cm_repair_cp_ops
Definition: cm.h:171
Definition: cp.h:160
M0_LEAVE()
void fop_release(struct m0_ref *ref)
Definition: stats_ut_svc.c:148
M0_INTERNAL int m0_dix_cm_data_next(struct m0_cm *cm, struct m0_cm_cp *cp)
Definition: cm.c:535
static void dix_repair_cm_stop(struct m0_cm *cm)
Definition: cm.c:68
M0_INTERNAL void m0_dix_cm_fini(struct m0_cm *cm)
Definition: cm.c:461
const struct m0_cm_ops dix_repair_ops
Definition: cm.c:79
M0_INTERNAL int m0_dix_cm_setup(struct m0_cm *cm)
Definition: cm.c:332
static struct m0_cm * cm
Definition: cm.c:63
#define M0_ENTRY(...)
Definition: trace.h:170
static int dix_repair_cm_prepare(struct m0_cm *cm)
Definition: cm.c:49
Definition: refs.h:34
M0_INTERNAL int m0_dix_cm_ag_alloc(struct m0_cm *cm, const struct m0_cm_ag_id *id, bool has_incoming, struct m0_cm_aggr_group **out)
Definition: ag.c:88
M0_INTERNAL int m0_dix_cm_ag_next(struct m0_cm *cm, const struct m0_cm_ag_id *id_curr, struct m0_cm_ag_id *id_next)
Definition: cm.c:473
const struct m0_cm_cp_ops * c_ops
Definition: cp.h:169
Definition: cm.h:286
M0_INTERNAL struct m0_cm_cp * m0_dix_cm_cp_alloc(struct m0_cm *cm)
Definition: cp.c:90
Definition: cm.h:117
M0_INTERNAL int m0_dix_cm_start(struct m0_cm *cm)
Definition: cm.c:367
enum m0_cm_op dcm_op
Definition: cm.h:125
M0_INTERNAL bool m0_dix_is_peer(struct m0_cm *cm, struct m0_reqh_service_ctx *ctx)
Definition: cm.c:623
static const char * local_ep(const struct m0_cm *cm)
Definition: cm_utils.c:397
Definition: cm.h:166
int(* cmo_setup)(struct m0_cm *cm)
Definition: cm.h:292
static struct m0_fop * fop
Definition: item.c:57
M0_INTERNAL int m0_dix_get_space_for(struct m0_cm *cm, const struct m0_cm_ag_id *id, size_t *count)
Definition: cm.c:465
#define out(...)
Definition: gen.c:41
M0_INTERNAL void m0_dix_cm_stop(struct m0_cm *cm)
Definition: cm.c:425
M0_INTERNAL int m0_dix_repair_sw_onwire_fop_setup(struct m0_cm *cm, struct m0_fop *fop, void(*fop_release)(struct m0_ref *), uint64_t proxy_id, const char *local_ep, const struct m0_cm_sw *sw, const struct m0_cm_sw *out_interval)
Definition: sw_fop.c:92
Definition: ag.h:49
Definition: fop.h:79