Motr  M0
log_sched.h
Go to the documentation of this file.
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 2015-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_LOG_SCHED_H__
26 #define __MOTR_BE_LOG_SCHED_H__
27 
28 #include "lib/types.h" /* m0_bindex_t */
29 #include "be/io.h" /* m0_be_io */
30 #include "be/io_sched.h" /* m0_be_io_sched */
31 #include "be/op.h" /* m0_be_op */
32 
39 struct m0_be_log_record;
40 
43 };
44 
45 /*
46  * Log I/O scheduler.
47  *
48  * Log scheduler is used when log records and log header are read or
49  * written to the log. Log store header doesn't use log scheduler for I/O.
50  *
51  * @see m0_be_io_sched
52  */
56 };
57 
59 struct m0_be_log_io {
60  uint32_t lio_log_bshift;
61  struct m0_buf lio_buf;
62  void *lio_buf_addr;
69 };
70 
71 M0_INTERNAL int m0_be_log_sched_init(struct m0_be_log_sched *sched,
72  struct m0_be_log_sched_cfg *cfg);
73 M0_INTERNAL void m0_be_log_sched_fini(struct m0_be_log_sched *sched);
74 M0_INTERNAL void m0_be_log_sched_lock(struct m0_be_log_sched *sched);
75 M0_INTERNAL void m0_be_log_sched_unlock(struct m0_be_log_sched *sched);
76 M0_INTERNAL bool m0_be_log_sched_is_locked(struct m0_be_log_sched *sched);
77 /*
78  * Add lio to the scheduler queue.
79  *
80  * @see m0_be_log_sched
81  */
82 M0_INTERNAL void m0_be_log_sched_add(struct m0_be_log_sched *sched,
83  struct m0_be_log_io *lio,
84  struct m0_be_op *op);
85 
86 M0_INTERNAL int m0_be_log_io_init(struct m0_be_log_io *lio);
87 M0_INTERNAL void m0_be_log_io_fini(struct m0_be_log_io *lio);
88 M0_INTERNAL void m0_be_log_io_reset(struct m0_be_log_io *lio);
89 
90 M0_INTERNAL int m0_be_log_io_allocate(struct m0_be_log_io *lio,
91  struct m0_be_io_credit *iocred,
92  uint32_t log_bshift);
93 M0_INTERNAL void m0_be_log_io_deallocate(struct m0_be_log_io *lio);
94 
95 M0_INTERNAL struct m0_bufvec *m0_be_log_io_bufvec(struct m0_be_log_io *lio);
96 M0_INTERNAL struct m0_be_io *m0_be_log_io_be_io(struct m0_be_log_io *lio);
97 
98 M0_INTERNAL void m0_be_log_io_user_data_set(struct m0_be_log_io *lio,
99  void *data);
100 M0_INTERNAL void *m0_be_log_io_user_data(struct m0_be_log_io *lio);
101 M0_INTERNAL bool m0_be_log_io_is_empty(struct m0_be_log_io *lio);
102 
103 
105 #endif /* __MOTR_BE_LOG_SCHED_H__ */
106 
107 /*
108  * Local variables:
109  * c-indentation-style: "K&R"
110  * c-basic-offset: 8
111  * tab-width: 8
112  * fill-column: 80
113  * scroll-step: 1
114  * End:
115  */
116 /*
117  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
118  */
struct m0_be_log_record * lio_record
Definition: log_sched.h:67
uint32_t lio_log_bshift
Definition: log_sched.h:60
struct m0_bufvec lio_bufvec
Definition: log_sched.h:64
struct m0_bufvec data
Definition: di.c:40
m0_bcount_t lio_buf_size
Definition: log_sched.h:63
uint64_t m0_bindex_t
Definition: types.h:80
uint64_t m0_bcount_t
Definition: types.h:77
m0_bindex_t lsh_pos
Definition: log_sched.h:55
op
Definition: libdemo.c:64
Definition: buf.h:37
M0_INTERNAL struct m0_be_io * m0_be_log_io_be_io(struct m0_be_log_io *lio)
Definition: log_sched.c:164
M0_INTERNAL bool m0_be_log_sched_is_locked(struct m0_be_log_sched *sched)
Definition: log_sched.c:62
M0_INTERNAL bool m0_be_log_io_is_empty(struct m0_be_log_io *lio)
Definition: log_sched.c:180
void * lio_buf_addr
Definition: log_sched.h:62
M0_INTERNAL void m0_be_log_sched_add(struct m0_be_log_sched *sched, struct m0_be_log_io *lio, struct m0_be_op *op)
Definition: log_sched.c:67
M0_INTERNAL void * m0_be_log_io_user_data(struct m0_be_log_io *lio)
Definition: log_sched.c:175
M0_INTERNAL void m0_be_log_io_deallocate(struct m0_be_log_io *lio)
Definition: log_sched.c:150
M0_INTERNAL void m0_be_log_io_user_data_set(struct m0_be_log_io *lio, void *data)
Definition: log_sched.c:169
struct m0_be_io_sched_cfg lsch_io_sched_cfg
Definition: log_sched.h:42
M0_INTERNAL struct m0_bufvec * m0_be_log_io_bufvec(struct m0_be_log_io *lio)
Definition: log_sched.c:159
M0_INTERNAL int m0_be_log_io_allocate(struct m0_be_log_io *lio, struct m0_be_io_credit *iocred, uint32_t log_bshift)
Definition: log_sched.c:114
M0_INTERNAL int m0_be_log_io_init(struct m0_be_log_io *lio)
Definition: log_sched.c:97
struct m0_be_log_sched * lio_sched
Definition: log_sched.h:66
struct m0_buf lio_buf
Definition: log_sched.h:61
Definition: io.h:87
M0_INTERNAL void m0_be_log_sched_fini(struct m0_be_log_sched *sched)
Definition: log_sched.c:47
struct m0_be_io lio_be_io
Definition: log_sched.h:65
M0_INTERNAL void m0_be_log_io_fini(struct m0_be_log_io *lio)
Definition: log_sched.c:102
Definition: op.h:74
M0_INTERNAL void m0_be_log_sched_lock(struct m0_be_log_sched *sched)
Definition: log_sched.c:52
M0_INTERNAL void m0_be_log_sched_unlock(struct m0_be_log_sched *sched)
Definition: log_sched.c:57
M0_INTERNAL int m0_be_log_sched_init(struct m0_be_log_sched *sched, struct m0_be_log_sched_cfg *cfg)
Definition: log_sched.c:38
void * lio_user_data
Definition: log_sched.h:68
M0_INTERNAL void m0_be_log_io_reset(struct m0_be_log_io *lio)
Definition: log_sched.c:106
Definition: vec.h:145
struct m0_be_io_sched lsh_io_sched
Definition: log_sched.h:54