]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/src/metadata/metadata_partition.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / ocf / src / metadata / metadata_partition.h
1 /*
2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
4 */
5
6 #ifndef __METADATA_PARTITION_H__
7 #define __METADATA_PARTITION_H__
8
9 #include "metadata_partition_structs.h"
10 #include "../ocf_cache_priv.h"
11
12 #define PARTITION_DEFAULT 0
13 #define PARTITION_INVALID ((ocf_part_id_t)-1)
14 #define PARTITION_SIZE_MAX ((ocf_cache_line_t)-1)
15
16 static inline ocf_part_id_t ocf_metadata_get_partition_id(
17 struct ocf_cache *cache, ocf_cache_line_t line)
18 {
19 return cache->metadata.iface.get_partition_id(cache, line);
20 }
21
22 static inline ocf_cache_line_t ocf_metadata_get_partition_next(
23 struct ocf_cache *cache, ocf_cache_line_t line)
24 {
25 return cache->metadata.iface.get_partition_next(cache, line);
26 }
27
28 static inline ocf_cache_line_t ocf_metadata_get_partition_prev(
29 struct ocf_cache *cache, ocf_cache_line_t line)
30 {
31 return cache->metadata.iface.get_partition_prev(cache, line);
32 }
33
34 static inline void ocf_metadata_get_partition_info(
35 struct ocf_cache *cache, ocf_cache_line_t line,
36 ocf_part_id_t *part_id, ocf_cache_line_t *next_line,
37 ocf_cache_line_t *prev_line)
38 {
39 cache->metadata.iface.get_partition_info(cache, line, part_id,
40 next_line, prev_line);
41 }
42
43 static inline void ocf_metadata_set_partition_next(
44 struct ocf_cache *cache, ocf_cache_line_t line,
45 ocf_cache_line_t next_line)
46 {
47 cache->metadata.iface.set_partition_next(cache, line, next_line);
48 }
49
50 static inline void ocf_metadata_set_partition_prev(
51 struct ocf_cache *cache, ocf_cache_line_t line,
52 ocf_cache_line_t prev_line)
53 {
54 cache->metadata.iface.set_partition_prev(cache, line, prev_line);
55 }
56
57 static inline void ocf_metadata_set_partition_info(
58 struct ocf_cache *cache, ocf_cache_line_t line,
59 ocf_part_id_t part_id, ocf_cache_line_t next_line,
60 ocf_cache_line_t prev_line)
61 {
62 cache->metadata.iface.set_partition_info(cache, line, part_id,
63 next_line, prev_line);
64 }
65
66 void ocf_metadata_add_to_free_list(struct ocf_cache *cache,
67 ocf_cache_line_t cline);
68
69 void ocf_metadata_remove_from_free_list(struct ocf_cache *cache,
70 ocf_cache_line_t cline);
71
72 void ocf_metadata_add_to_partition(struct ocf_cache *cache,
73 ocf_part_id_t part_id, ocf_cache_line_t line);
74
75 void ocf_metadata_remove_from_partition(struct ocf_cache *cache,
76 ocf_part_id_t part_id, ocf_cache_line_t line);
77
78 #endif /* __METADATA_PARTITION_H__ */