Motr  M0
fl.h
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 
23 #pragma once
24 
25 #ifndef __MOTR_BE_FL_H__
26 #define __MOTR_BE_FL_H__
27 
28 #include "be/list.h" /* m0_be_list */
29 #include "be/list_xc.h"
30 
37 struct be_alloc_chunk;
38 
39 enum {
41  M0_BE_FL_NR = 128,
45 };
46 
48 
55 };
56 
62 struct m0_be_fl_size {
64 } M0_XCA_RECORD M0_XCA_DOMAIN(be);
65 
67 struct m0_be_fl {
68  /*
69  * If i is from range [0, M0_BE_FL_NR) then i-th element of array
70  * contains free list with chunk sizes in range
71  * [i * M0_BE_FL_STEP, (i + 1) * M0_BE_FL_STEP).
72  * M0_BE_FL_NR-th element contains list of chunks
73  * with size >= (M0_BE_FL_NR * M0_BE_FL_STEP).
74  * @see m0_be_fl_add(), m0_be_fl_pick().
75  */
77 } M0_XCA_RECORD M0_XCA_DOMAIN(be);
78 
79 M0_INTERNAL bool m0_be_fl__invariant(struct m0_be_fl *fl);
80 
81 M0_INTERNAL void m0_be_fl_create(struct m0_be_fl *fl,
82  struct m0_be_tx *tx,
83  struct m0_be_seg *seg);
84 M0_INTERNAL void m0_be_fl_destroy(struct m0_be_fl *fl,
85  struct m0_be_tx *tx);
86 
87 M0_INTERNAL void m0_be_fl_add(struct m0_be_fl *fl,
88  struct m0_be_tx *tx,
89  struct be_alloc_chunk *chunk);
90 M0_INTERNAL void m0_be_fl_del(struct m0_be_fl *fl,
91  struct m0_be_tx *tx,
92  struct be_alloc_chunk *chunk);
93 
95 M0_INTERNAL struct be_alloc_chunk *m0_be_fl_pick(struct m0_be_fl *fl,
97 
98 M0_INTERNAL void m0_be_fl_credit(struct m0_be_fl *fl,
99  enum m0_be_fl_op fl_op,
100  struct m0_be_tx_credit *accum);
101 
103 #endif /* __MOTR_BE_FL_H__ */
104 
105 /*
106  * Local variables:
107  * c-indentation-style: "K&R"
108  * c-basic-offset: 8
109  * tab-width: 8
110  * fill-column: 80
111  * scroll-step: 1
112  * End:
113  */
114 /*
115  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
116  */
Definition: fl.h:54
enum @32 M0_XCA_DOMAIN
M0_INTERNAL void m0_be_fl_destroy(struct m0_be_fl *fl, struct m0_be_tx *tx)
Definition: fl.c:120
struct m0_be_fl_size bfl_free[M0_BE_FL_NR+1]
Definition: fl.h:76
uint64_t m0_bcount_t
Definition: types.h:77
Definition: fl.h:67
M0_INTERNAL void m0_be_fl_create(struct m0_be_fl *fl, struct m0_be_tx *tx, struct m0_be_seg *seg)
Definition: fl.c:110
M0_BASSERT(M0_BE_FL_STEP *M0_BE_FL_NR< M0_BCOUNT_MAX)
M0_INTERNAL void m0_be_fl_credit(struct m0_be_fl *fl, enum m0_be_fl_op fl_op, struct m0_be_tx_credit *accum)
Definition: fl.c:218
Definition: fl.h:41
M0_INTERNAL bool m0_be_fl__invariant(struct m0_be_fl *fl)
Definition: fl.c:143
Allocator chunk.
m0_be_fl_op
Definition: fl.h:50
M0_INTERNAL struct be_alloc_chunk * m0_be_fl_pick(struct m0_be_fl *fl, m0_bcount_t size)
Definition: fl.c:178
struct m0_be_list bfs_list
Definition: fl.h:63
Definition: seg.h:66
Definition: fl.h:53
M0_INTERNAL void m0_be_fl_add(struct m0_be_fl *fl, struct m0_be_tx *tx, struct be_alloc_chunk *chunk)
Definition: fl.c:151
m0_bcount_t size
Definition: di.c:39
static struct m0_be_seg * seg
Definition: btree.c:40
M0_INTERNAL void m0_be_fl_del(struct m0_be_fl *fl, struct m0_be_tx *tx, struct be_alloc_chunk *chunk)
Definition: fl.c:165
static struct m0_be_ut_backend be
Definition: service_ut.c:59
Definition: tx.h:280