]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/src/metadata/metadata_partition.h
update source to Ceph Pacific 16.2.2
[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 void ocf_metadata_get_partition_info(
17 struct ocf_cache *cache, ocf_cache_line_t line,
18 ocf_part_id_t *part_id, ocf_cache_line_t *next_line,
19 ocf_cache_line_t *prev_line)
20 {
21 cache->metadata.iface.get_partition_info(cache, line, part_id,
22 next_line, prev_line);
23 }
24
25 static inline ocf_part_id_t ocf_metadata_get_partition_id(
26 struct ocf_cache *cache, ocf_cache_line_t line)
27 {
28 ocf_part_id_t part_id;
29
30 ocf_metadata_get_partition_info(cache, line, &part_id, NULL, NULL);
31
32 return part_id;
33 }
34
35 static inline ocf_cache_line_t ocf_metadata_get_partition_next(
36 struct ocf_cache *cache, ocf_cache_line_t line)
37 {
38 ocf_cache_line_t next;
39
40 ocf_metadata_get_partition_info(cache, line, NULL, &next, NULL);
41
42 return next;
43 }
44
45 static inline ocf_cache_line_t ocf_metadata_get_partition_prev(
46 struct ocf_cache *cache, ocf_cache_line_t line)
47 {
48 ocf_cache_line_t prev;
49
50 ocf_metadata_get_partition_info(cache, line, NULL, NULL, &prev);
51
52 return prev;
53 }
54
55 static inline void ocf_metadata_set_partition_next(
56 struct ocf_cache *cache, ocf_cache_line_t line,
57 ocf_cache_line_t next_line)
58 {
59 cache->metadata.iface.set_partition_next(cache, line, next_line);
60 }
61
62 static inline void ocf_metadata_set_partition_prev(
63 struct ocf_cache *cache, ocf_cache_line_t line,
64 ocf_cache_line_t prev_line)
65 {
66 cache->metadata.iface.set_partition_prev(cache, line, prev_line);
67 }
68
69 static inline void ocf_metadata_set_partition_info(
70 struct ocf_cache *cache, ocf_cache_line_t line,
71 ocf_part_id_t part_id, ocf_cache_line_t next_line,
72 ocf_cache_line_t prev_line)
73 {
74 cache->metadata.iface.set_partition_info(cache, line, part_id,
75 next_line, prev_line);
76 }
77
78 void ocf_metadata_add_to_partition(struct ocf_cache *cache,
79 ocf_part_id_t part_id, ocf_cache_line_t line);
80
81 void ocf_metadata_remove_from_partition(struct ocf_cache *cache,
82 ocf_part_id_t part_id, ocf_cache_line_t line);
83
84 #endif /* __METADATA_PARTITION_H__ */