]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/src/ocf_volume_priv.h
1e51a3763a3132b7845e7e0f39e4c1406c6cd5c7
[ceph.git] / ceph / src / spdk / ocf / src / ocf_volume_priv.h
1 /*
2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
4 */
5
6 #ifndef __OCF_VOLUME_PRIV_H__
7 #define __OCF_VOLUME_PRIV_H__
8
9 #include "ocf_env.h"
10 #include "ocf_io_priv.h"
11 #include "utils/utils_refcnt.h"
12 #include "utils/utils_io_allocator.h"
13
14 struct ocf_volume_extended {
15 ocf_io_allocator_type_t allocator_type;
16 };
17
18 struct ocf_volume_type {
19 const struct ocf_volume_properties *properties;
20 struct ocf_io_allocator allocator;
21 };
22
23 struct ocf_volume {
24 ocf_volume_type_t type;
25 struct ocf_volume_uuid uuid;
26 bool opened;
27 bool uuid_copy;
28 void *priv;
29 ocf_cache_t cache;
30 struct list_head core_pool_item;
31 struct {
32 unsigned discard_zeroes:1;
33 /* true if reading discarded pages returns 0 */
34 } features;
35 struct ocf_refcnt refcnt;
36 };
37
38 int ocf_volume_type_init(struct ocf_volume_type **type,
39 const struct ocf_volume_properties *properties,
40 const struct ocf_volume_extended *extended);
41
42 void ocf_volume_type_deinit(struct ocf_volume_type *type);
43
44 void ocf_volume_move(ocf_volume_t volume, ocf_volume_t from);
45
46 void ocf_volume_set_uuid(ocf_volume_t volume,
47 const struct ocf_volume_uuid *uuid);
48
49 static inline void ocf_volume_submit_metadata(struct ocf_io *io)
50 {
51 ocf_volume_t volume = ocf_io_get_volume(io);
52
53 ENV_BUG_ON(!volume->type->properties->ops.submit_metadata);
54
55 volume->type->properties->ops.submit_metadata(io);
56 }
57
58 static inline void ocf_volume_submit_write_zeroes(struct ocf_io *io)
59 {
60 ocf_volume_t volume = ocf_io_get_volume(io);
61
62 ENV_BUG_ON(!volume->type->properties->ops.submit_write_zeroes);
63
64 volume->type->properties->ops.submit_write_zeroes(io);
65 }
66
67 #endif /*__OCF_VOLUME_PRIV_H__ */