Motr  M0
meta.h
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 #pragma once
24 
25 #ifndef __MOTR_DIX_META_H__
26 #define __MOTR_DIX_META_H__
27 
74 #include "lib/types.h"
75 #include "lib/chan.h"
76 #include "lib/vec.h"
77 #include "lib/mutex.h"
78 #include "fid/fid.h"
79 #include "fid/fid_xc.h"
80 #include "dix/layout.h"
81 #include "dix/req.h"
82 
83 /* Import */
84 struct m0_sm_group;
85 struct m0_dix_cli;
86 struct m0_dix_layout;
87 struct m0_dix_ldesc;
88 
89 M0_EXTERN const struct m0_fid m0_dix_root_fid;
90 M0_EXTERN const struct m0_fid m0_dix_layout_fid;
91 M0_EXTERN const struct m0_fid m0_dix_ldescr_fid;
92 
97  struct m0_chan dmr_chan;
100 };
101 
108 M0_INTERNAL void m0_dix_meta_req_init(struct m0_dix_meta_req *req,
109  struct m0_dix_cli *cli,
110  struct m0_sm_group *grp);
111 
115 M0_INTERNAL void m0_dix_meta_req_fini(struct m0_dix_meta_req *req);
116 
124 M0_INTERNAL void m0_dix_meta_lock(struct m0_dix_meta_req *req);
125 
129 M0_INTERNAL void m0_dix_meta_unlock(struct m0_dix_meta_req *req);
130 
134 M0_INTERNAL void m0_dix_meta_req_fini_lock(struct m0_dix_meta_req *req);
135 
143 M0_INTERNAL int m0_dix_meta_generic_rc(const struct m0_dix_meta_req *req);
144 
151 M0_INTERNAL int m0_dix_meta_item_rc(const struct m0_dix_meta_req *req,
152  uint64_t idx);
153 
157 M0_INTERNAL int m0_dix_meta_req_nr(const struct m0_dix_meta_req *req);
158 
165 M0_INTERNAL int m0_dix_meta_create(struct m0_dix_cli *cli,
166  struct m0_sm_group *grp,
167  struct m0_dix_ldesc *dld_layout,
168  struct m0_dix_ldesc *dld_ldescr);
169 
181 M0_INTERNAL int m0_dix_meta_check(struct m0_dix_cli *cli,
182  struct m0_sm_group *grp,
183  bool *result);
184 
191 M0_INTERNAL int m0_dix_meta_destroy(struct m0_dix_cli *cli,
192  struct m0_sm_group *grp);
193 
200 M0_INTERNAL int m0_dix_root_read(struct m0_dix_meta_req *req);
201 
205 M0_INTERNAL int m0_dix_root_read_rep(struct m0_dix_meta_req *req,
206  struct m0_dix_ldesc *layout,
207  struct m0_dix_ldesc *ldescr);
208 
213 M0_INTERNAL int m0_dix_ldescr_put(struct m0_dix_meta_req *req,
214  const uint64_t *lid,
215  const struct m0_dix_ldesc *ldesc,
216  uint32_t nr);
217 
223 M0_INTERNAL int m0_dix_ldescr_get(struct m0_dix_meta_req *req,
224  const uint64_t *lid,
225  uint32_t nr);
226 
232 M0_INTERNAL int m0_dix_ldescr_rep_get(struct m0_dix_meta_req *req,
233  uint64_t idx,
234  struct m0_dix_ldesc *ldesc);
235 
240 M0_INTERNAL int m0_dix_ldescr_del(struct m0_dix_meta_req *req,
241  const uint64_t *lid,
242  uint32_t nr);
243 
251 M0_INTERNAL int m0_dix_layout_put(struct m0_dix_meta_req *req,
252  const struct m0_fid *fid,
253  const struct m0_dix_layout *dlay,
254  uint32_t nr,
255  uint32_t flags);
256 
264 M0_INTERNAL int m0_dix_layout_get(struct m0_dix_meta_req *req,
265  const struct m0_fid *fid,
266  uint32_t nr);
267 
273 M0_INTERNAL int m0_dix_layout_del(struct m0_dix_meta_req *req,
274  const struct m0_fid *fid,
275  uint32_t nr);
276 
283 M0_INTERNAL int m0_dix_layout_rep_get(struct m0_dix_meta_req *req,
284  uint64_t idx,
285  struct m0_dix_layout *dlay);
286 
297 M0_INTERNAL int m0_dix_index_list(struct m0_dix_meta_req *req,
298  const struct m0_fid *start_fid,
299  uint32_t indices_nr);
300 
307 M0_INTERNAL int m0_dix_index_list_rep_nr(struct m0_dix_meta_req *req);
308 
312 M0_INTERNAL int m0_dix_index_list_rep(struct m0_dix_meta_req *req,
313  uint32_t idx,
314  struct m0_fid *fid);
315 
324 M0_INTERNAL int m0_dix__meta_val_enc(const struct m0_fid *fid,
325  const struct m0_dix_ldesc *dld,
326  uint32_t nr,
327  struct m0_bufvec *vals);
333 M0_INTERNAL int m0_dix__meta_val_dec(const struct m0_bufvec *vals,
334  struct m0_fid *out_fid,
335  struct m0_dix_ldesc *out_dld,
336  uint32_t nr);
337 
345 M0_INTERNAL int m0_dix__ldesc_vals_enc(const uint64_t *lid,
346  const struct m0_dix_ldesc *ldesc,
347  uint32_t nr,
348  struct m0_bufvec *keys,
349  struct m0_bufvec *vals);
350 
357 M0_INTERNAL int m0_dix__ldesc_vals_dec(const struct m0_bufvec *keys,
358  const struct m0_bufvec *vals,
359  uint64_t *out_lid,
360  struct m0_dix_ldesc *out_ldesc,
361  uint32_t nr);
362 
370 M0_INTERNAL int m0_dix__layout_vals_enc(const struct m0_fid *fid,
371  const struct m0_dix_layout *dlay,
372  uint32_t nr,
373  struct m0_bufvec *keys,
374  struct m0_bufvec *vals);
375 
382 M0_INTERNAL int m0_dix__layout_vals_dec(const struct m0_bufvec *keys,
383  const struct m0_bufvec *vals,
384  struct m0_fid *out_fid,
385  struct m0_dix_layout *out_dlay,
386  uint32_t nr);
387 
390 #endif /* __MOTR_DIX_META_H__ */
391 
392 /*
393  * Local variables:
394  * c-indentation-style: "K&R"
395  * c-basic-offset: 8
396  * tab-width: 8
397  * fill-column: 80
398  * scroll-step: 1
399  * End:
400  */
401 /*
402  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
403  */
M0_INTERNAL int m0_dix_layout_put(struct m0_dix_meta_req *req, const struct m0_fid *fid, const struct m0_dix_layout *dlay, uint32_t nr, uint32_t flags)
Definition: meta.c:574
static size_t nr
Definition: dump.c:1505
M0_INTERNAL int m0_dix_layout_get(struct m0_dix_meta_req *req, const struct m0_fid *fid, uint32_t nr)
Definition: meta.c:626
M0_EXTERN const struct m0_fid m0_dix_root_fid
Definition: meta.h:89
int const char const void size_t int flags
Definition: dir.c:328
M0_INTERNAL int m0_dix_meta_create(struct m0_dix_cli *cli, struct m0_sm_group *grp, struct m0_dix_ldesc *dld_layout, struct m0_dix_ldesc *dld_ldescr)
Definition: meta.c:326
static struct io_request req
Definition: file.c:100
M0_INTERNAL int m0_dix_root_read(struct m0_dix_meta_req *req)
Definition: meta.c:379
static struct m0_sm_group * grp
Definition: bytecount.c:38
M0_INTERNAL int m0_dix_ldescr_rep_get(struct m0_dix_meta_req *req, uint64_t idx, struct m0_dix_ldesc *ldesc)
Definition: meta.c:530
M0_INTERNAL void m0_dix_meta_req_init(struct m0_dix_meta_req *req, struct m0_dix_cli *cli, struct m0_sm_group *grp)
Definition: meta.c:259
M0_INTERNAL int m0_dix_index_list_rep_nr(struct m0_dix_meta_req *req)
Definition: meta.c:699
M0_EXTERN const struct m0_fid m0_dix_ldescr_fid
Definition: meta.h:91
M0_INTERNAL int m0_dix_root_read_rep(struct m0_dix_meta_req *req, struct m0_dix_ldesc *layout, struct m0_dix_ldesc *ldescr)
Definition: meta.c:443
struct m0_dix_req dmr_req
Definition: meta.h:94
M0_INTERNAL int m0_dix__layout_vals_dec(const struct m0_bufvec *keys, const struct m0_bufvec *vals, struct m0_fid *out_fid, struct m0_dix_layout *out_dlay, uint32_t nr)
Definition: encdec.c:157
struct m0_fid fid
Definition: di.c:46
M0_INTERNAL int m0_dix__ldesc_vals_enc(const uint64_t *lid, const struct m0_dix_ldesc *ldesc, uint32_t nr, struct m0_bufvec *keys, struct m0_bufvec *vals)
Definition: encdec.c:195
M0_INTERNAL int m0_dix_layout_rep_get(struct m0_dix_meta_req *req, uint64_t idx, struct m0_dix_layout *dlay)
Definition: meta.c:650
M0_INTERNAL int m0_dix__layout_vals_enc(const struct m0_fid *fid, const struct m0_dix_layout *dlay, uint32_t nr, struct m0_bufvec *keys, struct m0_bufvec *vals)
Definition: encdec.c:111
struct m0_bufvec dmr_vals
Definition: meta.h:96
M0_INTERNAL int m0_dix_ldescr_get(struct m0_dix_meta_req *req, const uint64_t *lid, uint32_t nr)
Definition: meta.c:506
M0_INTERNAL int m0_dix_meta_item_rc(const struct m0_dix_meta_req *req, uint64_t idx)
Definition: meta.c:314
M0_INTERNAL int m0_dix_meta_check(struct m0_dix_cli *cli, struct m0_sm_group *grp, bool *result)
Definition: meta.c:343
M0_INTERNAL void m0_dix_meta_unlock(struct m0_dix_meta_req *req)
Definition: meta.c:304
M0_INTERNAL void m0_dix_meta_req_fini(struct m0_dix_meta_req *req)
Definition: meta.c:285
Definition: chan.h:229
M0_INTERNAL int m0_dix__ldesc_vals_dec(const struct m0_bufvec *keys, const struct m0_bufvec *vals, uint64_t *out_lid, struct m0_dix_ldesc *out_ldesc, uint32_t nr)
Definition: encdec.c:234
M0_INTERNAL int m0_dix_index_list(struct m0_dix_meta_req *req, const struct m0_fid *start_fid, uint32_t indices_nr)
Definition: meta.c:669
M0_INTERNAL int m0_dix_index_list_rep(struct m0_dix_meta_req *req, uint32_t idx, struct m0_fid *fid)
Definition: meta.c:704
M0_INTERNAL void m0_dix_meta_req_fini_lock(struct m0_dix_meta_req *req)
Definition: meta.c:291
M0_INTERNAL int m0_dix__meta_val_dec(const struct m0_bufvec *vals, struct m0_fid *out_fid, struct m0_dix_ldesc *out_dld, uint32_t nr)
Definition: encdec.c:74
M0_INTERNAL int m0_dix_meta_destroy(struct m0_dix_cli *cli, struct m0_sm_group *grp)
Definition: meta.c:467
Definition: fid.h:38
M0_INTERNAL int m0_dix_ldescr_put(struct m0_dix_meta_req *req, const uint64_t *lid, const struct m0_dix_ldesc *ldesc, uint32_t nr)
Definition: meta.c:478
M0_INTERNAL int m0_dix_ldescr_del(struct m0_dix_meta_req *req, const uint64_t *lid, uint32_t nr)
Definition: meta.c:550
M0_INTERNAL int m0_dix_meta_generic_rc(const struct m0_dix_meta_req *req)
Definition: meta.c:309
struct m0_bufvec dmr_keys
Definition: meta.h:95
M0_INTERNAL int m0_dix_meta_req_nr(const struct m0_dix_meta_req *req)
Definition: meta.c:321
M0_EXTERN const struct m0_fid m0_dix_layout_fid
Definition: meta.h:90
M0_INTERNAL int m0_dix_layout_del(struct m0_dix_meta_req *req, const struct m0_fid *fid, uint32_t nr)
Definition: meta.c:603
struct m0_chan dmr_chan
Definition: meta.h:97
Definition: mutex.h:47
M0_INTERNAL void m0_dix_meta_lock(struct m0_dix_meta_req *req)
Definition: meta.c:299
struct m0_mutex dmr_wait_mutex
Definition: meta.h:98
M0_INTERNAL int m0_dix__meta_val_enc(const struct m0_fid *fid, const struct m0_dix_ldesc *dld, uint32_t nr, struct m0_bufvec *vals)
Definition: encdec.c:48
struct m0_clink dmr_clink
Definition: meta.h:99
Definition: vec.h:145