pyocf: collision addr helper
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
978620f9e3
commit
2dde108cd9
27
tests/functional/pyocf/c/helpers/collision_addr.c
Normal file
27
tests/functional/pyocf/c/helpers/collision_addr.c
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright(c) 2022-2022 Intel Corporation
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ocf/ocf_io.h"
|
||||||
|
#include "ocf/ocf_cache.h"
|
||||||
|
#include "../src/ocf/ocf_cache_priv.h"
|
||||||
|
#include "../src/ocf/metadata/metadata_raw.h"
|
||||||
|
#include "../src/ocf/metadata/metadata_internal.h"
|
||||||
|
|
||||||
|
// get collision metadata segment start and size (excluding padding)
|
||||||
|
uint64_t ocf_get_collision_start_page_helper(ocf_cache_t cache)
|
||||||
|
{
|
||||||
|
struct ocf_metadata_ctrl *ctrl = cache->metadata.priv;
|
||||||
|
struct ocf_metadata_raw *raw = &ctrl->raw_desc[metadata_segment_collision];
|
||||||
|
|
||||||
|
return raw->ssd_pages_offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t ocf_get_collision_page_count_helper(ocf_cache_t cache)
|
||||||
|
{
|
||||||
|
struct ocf_metadata_ctrl *ctrl = cache->metadata.priv;
|
||||||
|
struct ocf_metadata_raw *raw = &ctrl->raw_desc[metadata_segment_collision];
|
||||||
|
|
||||||
|
return raw->ssd_pages;
|
||||||
|
}
|
9
tests/functional/pyocf/c/helpers/collision_addr.h
Normal file
9
tests/functional/pyocf/c/helpers/collision_addr.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* Copyright(c) 2022-2022 Intel Corporation
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
uint64_t ocf_get_collision_start_page_helper(ocf_cache_t cache);
|
||||||
|
uint64_t ocf_get_collision_page_count_helper(ocf_cache_t cache);
|
16
tests/functional/pyocf/helpers.py
Normal file
16
tests/functional/pyocf/helpers.py
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
||||||
|
#
|
||||||
|
from .ocf import OcfLib
|
||||||
|
|
||||||
|
|
||||||
|
def get_collision_segment_page_location(cache):
|
||||||
|
lib = OcfLib.getInstance()
|
||||||
|
return int(lib.ocf_get_collision_start_page_helper(cache))
|
||||||
|
|
||||||
|
|
||||||
|
def get_collision_segment_size(cache):
|
||||||
|
lib = OcfLib.getInstance()
|
||||||
|
return int(lib.ocf_get_collision_page_count_helper(cache))
|
Loading…
Reference in New Issue
Block a user