]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/src/ocf_io_priv.h
import 15.2.0 Octopus source
[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 "ocf_request.h"
11
12 struct ocf_io_meta {
13 env_atomic ref_count;
14 struct ocf_request *req;
15 };
16
17 env_allocator *ocf_io_allocator_create(uint32_t size, const char *name);
18
19 void ocf_io_allocator_destroy(env_allocator *allocator);
20
21 struct ocf_io *ocf_io_new(ocf_volume_t volume);
22
23 static inline void ocf_io_start(struct ocf_io *io)
24 {
25 /*
26 * We want to call start() callback only once, so after calling
27 * we set it to NULL to prevent multiple calls.
28 */
29 if (io->start) {
30 io->start(io);
31 io->start = NULL;
32 }
33 }
34
35 static inline void ocf_io_end(struct ocf_io *io, int error)
36 {
37 if (io->end)
38 io->end(io, error);
39
40 }
41
42 #endif /* __OCF_IO_PRIV_H__ */