Motr  M0
io_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_IO_SCHED_H__
26 #define __MOTR_BE_IO_SCHED_H__
27 
34 #include "lib/types.h" /* bool */
35 #include "lib/tlist.h" /* m0_tl */
36 #include "lib/mutex.h" /* m0_mutex */
37 
38 struct m0_be_op;
39 struct m0_be_io;
40 struct m0_ext;
41 
45 };
46 
47 /*
48  * IO scheduler.
49  *
50  * It launches m0_be_io in m0_ext-based ordered queue.
51  *
52  * Highlighs:
53  * - write I/O:
54  * - each one should have m0_ext;
55  * - m0_ext for one I/O should not intersect with m0_ext for another I/O;
56  * - I/Os are launched in the m0_ext increasing order, without gaps. If there
57  * is no such I/O in the queue at the scheduler's current position then I/O
58  * after the gap is not launched until another I/O is added to fill the gap;
59  * - read I/O:
60  * - doesn't have m0_ext assigned (subject to change);
61  * - is launched after the last write I/O (at the time the read I/O is added
62  * to the scheduler's queue) from the queue is finished.
63  */
67  struct m0_tl bis_ios;
72 };
73 
74 M0_INTERNAL int m0_be_io_sched_init(struct m0_be_io_sched *sched,
75  struct m0_be_io_sched_cfg *cfg);
76 M0_INTERNAL void m0_be_io_sched_fini(struct m0_be_io_sched *sched);
77 M0_INTERNAL void m0_be_io_sched_lock(struct m0_be_io_sched *sched);
78 M0_INTERNAL void m0_be_io_sched_unlock(struct m0_be_io_sched *sched);
79 M0_INTERNAL bool m0_be_io_sched_is_locked(struct m0_be_io_sched *sched);
80 M0_INTERNAL void m0_be_io_sched_add(struct m0_be_io_sched *sched,
81  struct m0_be_io *io,
82  struct m0_ext *ext,
83  struct m0_be_op *op);
84 
86 #endif /* __MOTR_BE_IO_SCHED_H__ */
87 
88 /*
89  * Local variables:
90  * c-indentation-style: "K&R"
91  * c-basic-offset: 8
92  * tab-width: 8
93  * fill-column: 80
94  * scroll-step: 1
95  * End:
96  */
97 /*
98  * vim: tabstop=8 shiftwidth=8 noexpandtab textwidth=80 nowrap
99  */
m0_bcount_t bisc_pos_start
Definition: io_sched.h:44
m0_bcount_t bis_pos
Definition: io_sched.h:71
uint64_t m0_bcount_t
Definition: types.h:77
op
Definition: libdemo.c:64
M0_INTERNAL int m0_be_io_sched_init(struct m0_be_io_sched *sched, struct m0_be_io_sched_cfg *cfg)
Definition: io_sched.c:51
M0_INTERNAL bool m0_be_io_sched_is_locked(struct m0_be_io_sched *sched)
Definition: io_sched.c:80
Definition: tlist.h:251
M0_INTERNAL void m0_be_io_sched_lock(struct m0_be_io_sched *sched)
Definition: io_sched.c:70
M0_INTERNAL void m0_be_io_sched_fini(struct m0_be_io_sched *sched)
Definition: io_sched.c:64
static struct m0_stob_io io
Definition: ad.c:59
struct m0_mutex bis_lock
Definition: io_sched.h:68
M0_INTERNAL void m0_be_io_sched_unlock(struct m0_be_io_sched *sched)
Definition: io_sched.c:75
Definition: ext.h:37
M0_INTERNAL void m0_be_io_sched_add(struct m0_be_io_sched *sched, struct m0_be_io *io, struct m0_ext *ext, struct m0_be_op *op)
Definition: io_sched.c:176
bool bis_io_in_progress
Definition: io_sched.h:69
Definition: io.h:87
struct m0_tl bis_ios
Definition: io_sched.h:67
Definition: op.h:74
struct m0_be_io_sched_cfg bis_cfg
Definition: io_sched.h:65
Definition: mutex.h:47