]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/src/ocf_io_priv.h
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / ocf / src / ocf_io_priv.h
1 /*
2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
4 */
5
6 #ifndef __OCF_IO_PRIV_H__
7 #define __OCF_IO_PRIV_H__
8
9 #include "ocf/ocf.h"
10 #include "utils/utils_io_allocator.h"
11
12 struct ocf_io_meta {
13 ocf_volume_t volume;
14 const struct ocf_io_ops *ops;
15 env_atomic ref_count;
16 struct ocf_request *req;
17 };
18
19
20 struct ocf_io_internal {
21 struct ocf_io_meta meta;
22 struct ocf_io io;
23 };
24
25 int ocf_io_allocator_init(ocf_io_allocator_t allocator, ocf_io_allocator_type_t type,
26 uint32_t priv_size, const char *name);
27
28
29 struct ocf_io *ocf_io_new(ocf_volume_t volume, ocf_queue_t queue,
30 uint64_t addr, uint32_t bytes, uint32_t dir,
31 uint32_t io_class, uint64_t flags);
32
33 static inline void ocf_io_start(struct ocf_io *io)
34 {
35 /*
36 * We want to call start() callback only once, so after calling
37 * we set it to NULL to prevent multiple calls.
38 */
39 if (io->start) {
40 io->start(io);
41 io->start = NULL;
42 }
43 }
44
45 static inline void ocf_io_end(struct ocf_io *io, int error)
46 {
47 if (io->end)
48 io->end(io, error);
49
50 }
51
52 #endif /* __OCF_IO_PRIV_H__ */