2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
6 #ifndef __METADATA_PARTITION_H__
7 #define __METADATA_PARTITION_H__
9 #include "metadata_partition_structs.h"
10 #include "../ocf_cache_priv.h"
12 #define PARTITION_DEFAULT 0
13 #define PARTITION_INVALID ((ocf_part_id_t)-1)
14 #define PARTITION_SIZE_MAX ((ocf_cache_line_t)-1)
16 static inline ocf_part_id_t
ocf_metadata_get_partition_id(
17 struct ocf_cache
*cache
, ocf_cache_line_t line
)
19 return cache
->metadata
.iface
.get_partition_id(cache
, line
);
22 static inline ocf_cache_line_t
ocf_metadata_get_partition_next(
23 struct ocf_cache
*cache
, ocf_cache_line_t line
)
25 return cache
->metadata
.iface
.get_partition_next(cache
, line
);
28 static inline ocf_cache_line_t
ocf_metadata_get_partition_prev(
29 struct ocf_cache
*cache
, ocf_cache_line_t line
)
31 return cache
->metadata
.iface
.get_partition_prev(cache
, line
);
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
)
39 cache
->metadata
.iface
.get_partition_info(cache
, line
, part_id
,
40 next_line
, prev_line
);
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
)
47 cache
->metadata
.iface
.set_partition_next(cache
, line
, next_line
);
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
)
54 cache
->metadata
.iface
.set_partition_prev(cache
, line
, prev_line
);
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
)
62 cache
->metadata
.iface
.set_partition_info(cache
, line
, part_id
,
63 next_line
, prev_line
);
66 void ocf_metadata_add_to_free_list(struct ocf_cache
*cache
,
67 ocf_cache_line_t cline
);
69 void ocf_metadata_remove_from_free_list(struct ocf_cache
*cache
,
70 ocf_cache_line_t cline
);
72 void ocf_metadata_add_to_partition(struct ocf_cache
*cache
,
73 ocf_part_id_t part_id
, ocf_cache_line_t line
);
75 void ocf_metadata_remove_from_partition(struct ocf_cache
*cache
,
76 ocf_part_id_t part_id
, ocf_cache_line_t line
);
78 #endif /* __METADATA_PARTITION_H__ */