
Global free cacheline list is divided into a set of freelists, one per execution context. When attempting to map addres to cache, first the freelist for current execution context is considered (fast path). If current execution context freelist is empty (fast path failure), mapping function attempts to get freelist from other execution context list (slow path). The purpose of this change is improve concurrency in freelist access. It is part of fine granularity metadata lock implementation. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
85 lines
2.2 KiB
C
85 lines
2.2 KiB
C
/*
|
|
* Copyright(c) 2012-2018 Intel Corporation
|
|
* SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
*/
|
|
|
|
#ifndef __METADATA_PARTITION_H__
|
|
#define __METADATA_PARTITION_H__
|
|
|
|
#include "metadata_partition_structs.h"
|
|
#include "../ocf_cache_priv.h"
|
|
|
|
#define PARTITION_DEFAULT 0
|
|
#define PARTITION_INVALID ((ocf_part_id_t)-1)
|
|
#define PARTITION_SIZE_MAX ((ocf_cache_line_t)-1)
|
|
|
|
static inline void ocf_metadata_get_partition_info(
|
|
struct ocf_cache *cache, ocf_cache_line_t line,
|
|
ocf_part_id_t *part_id, ocf_cache_line_t *next_line,
|
|
ocf_cache_line_t *prev_line)
|
|
{
|
|
cache->metadata.iface.get_partition_info(cache, line, part_id,
|
|
next_line, prev_line);
|
|
}
|
|
|
|
static inline ocf_part_id_t ocf_metadata_get_partition_id(
|
|
struct ocf_cache *cache, ocf_cache_line_t line)
|
|
{
|
|
ocf_part_id_t part_id;
|
|
|
|
ocf_metadata_get_partition_info(cache, line, &part_id, NULL, NULL);
|
|
|
|
return part_id;
|
|
}
|
|
|
|
static inline ocf_cache_line_t ocf_metadata_get_partition_next(
|
|
struct ocf_cache *cache, ocf_cache_line_t line)
|
|
{
|
|
ocf_cache_line_t next;
|
|
|
|
ocf_metadata_get_partition_info(cache, line, NULL, &next, NULL);
|
|
|
|
return next;
|
|
}
|
|
|
|
static inline ocf_cache_line_t ocf_metadata_get_partition_prev(
|
|
struct ocf_cache *cache, ocf_cache_line_t line)
|
|
{
|
|
ocf_cache_line_t prev;
|
|
|
|
ocf_metadata_get_partition_info(cache, line, NULL, NULL, &prev);
|
|
|
|
return prev;
|
|
}
|
|
|
|
static inline void ocf_metadata_set_partition_next(
|
|
struct ocf_cache *cache, ocf_cache_line_t line,
|
|
ocf_cache_line_t next_line)
|
|
{
|
|
cache->metadata.iface.set_partition_next(cache, line, next_line);
|
|
}
|
|
|
|
static inline void ocf_metadata_set_partition_prev(
|
|
struct ocf_cache *cache, ocf_cache_line_t line,
|
|
ocf_cache_line_t prev_line)
|
|
{
|
|
cache->metadata.iface.set_partition_prev(cache, line, prev_line);
|
|
}
|
|
|
|
static inline void ocf_metadata_set_partition_info(
|
|
struct ocf_cache *cache, ocf_cache_line_t line,
|
|
ocf_part_id_t part_id, ocf_cache_line_t next_line,
|
|
ocf_cache_line_t prev_line)
|
|
{
|
|
cache->metadata.iface.set_partition_info(cache, line, part_id,
|
|
next_line, prev_line);
|
|
}
|
|
|
|
void ocf_metadata_add_to_partition(struct ocf_cache *cache,
|
|
ocf_part_id_t part_id, ocf_cache_line_t line);
|
|
|
|
void ocf_metadata_remove_from_partition(struct ocf_cache *cache,
|
|
ocf_part_id_t part_id, ocf_cache_line_t line);
|
|
|
|
#endif /* __METADATA_PARTITION_H__ */
|