]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/src/metadata/metadata_collision.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / ocf / src / metadata / metadata_collision.h
1 /*
2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
4 */
5
6 #ifndef __METADATA_COLLISION_H__
7 #define __METADATA_COLLISION_H__
8
9 /**
10 * @brief Metadata map structure
11 */
12
13 struct ocf_metadata_list_info {
14 ocf_cache_line_t prev_col;
15 /*!< Previous cache line in collision list */
16 ocf_cache_line_t next_col;
17 /*!< Next cache line in collision list*/
18 ocf_cache_line_t partition_prev;
19 /*!< Previous cache line in the same partition*/
20 ocf_cache_line_t partition_next;
21 /*!< Next cache line in the same partition*/
22 ocf_part_id_t partition_id : 8;
23 /*!< ID of partition where is assigned this cache line*/
24 } __attribute__((packed));
25
26 /**
27 * @brief Metadata map structure
28 */
29
30 struct ocf_metadata_map {
31 uint64_t core_line;
32 /*!< Core line addres on cache mapped by this strcture */
33
34 uint16_t core_id;
35 /*!< ID of core where is assigned this cache line*/
36
37 uint8_t status[];
38 /*!< Entry status structure e.g. valid, dirty...*/
39 } __attribute__((packed));
40
41 static inline ocf_cache_line_t ocf_metadata_map_lg2phy(
42 struct ocf_cache *cache, ocf_cache_line_t coll_idx)
43 {
44 return cache->metadata.iface.layout_iface->lg2phy(cache,
45 coll_idx);
46 }
47
48 static inline ocf_cache_line_t ocf_metadata_map_phy2lg(
49 struct ocf_cache *cache, ocf_cache_line_t cache_line)
50 {
51 return cache->metadata.iface.layout_iface->phy2lg(cache,
52 cache_line);
53 }
54
55 static inline void ocf_metadata_set_collision_info(
56 struct ocf_cache *cache, ocf_cache_line_t line,
57 ocf_cache_line_t next, ocf_cache_line_t prev)
58 {
59 cache->metadata.iface.set_collision_info(cache, line, next, prev);
60 }
61
62 static inline void ocf_metadata_get_collision_info(
63 struct ocf_cache *cache, ocf_cache_line_t line,
64 ocf_cache_line_t *next, ocf_cache_line_t *prev)
65 {
66 cache->metadata.iface.get_collision_info(cache, line, next, prev);
67 }
68
69 static inline void ocf_metadata_set_collision_next(
70 struct ocf_cache *cache, ocf_cache_line_t line,
71 ocf_cache_line_t next)
72 {
73 cache->metadata.iface.set_collision_next(cache, line, next);
74 }
75
76 static inline void ocf_metadata_set_collision_prev(
77 struct ocf_cache *cache, ocf_cache_line_t line,
78 ocf_cache_line_t prev)
79 {
80 cache->metadata.iface.set_collision_prev(cache, line, prev);
81 }
82
83 static inline ocf_cache_line_t ocf_metadata_get_collision_next(
84 struct ocf_cache *cache, ocf_cache_line_t line)
85 {
86 return cache->metadata.iface.get_collision_next(cache, line);
87 }
88
89 static inline ocf_cache_line_t ocf_metadata_get_collision_prev(
90 struct ocf_cache *cache, ocf_cache_line_t line)
91 {
92 return cache->metadata.iface.get_collision_prev(cache, line);
93 }
94
95 void ocf_metadata_add_to_collision(struct ocf_cache *cache,
96 ocf_core_id_t core_id, uint64_t core_line,
97 ocf_cache_line_t hash, ocf_cache_line_t cache_line);
98
99 void ocf_metadata_remove_from_collision(struct ocf_cache *cache,
100 ocf_cache_line_t line, ocf_part_id_t part_id);
101
102 #endif /* METADATA_COLLISION_H_ */