Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions inc/ocf_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ _Static_assert(OCF_MAX_T(uint32_t, OCF_CORE_ID_BITS) > OCF_CORE_NUM,
* Size of core name
*/
#define OCF_CORE_NAME_SIZE 32
/**
* Size of persistent core user metadata
*/
#define OCF_CORE_USER_DATA_SIZE 64
/**
* Minimum value of valid core sequence number
*/
Expand Down
13 changes: 2 additions & 11 deletions src/cleaning/acp_structs.h
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2023-2025 Huawei Technologies Co., Ltd.
* Copyright(c) 2026 Unvertical
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __CLEANING_AGGRESSIVE_STRUCTS_H__
#define __CLEANING_AGGRESSIVE_STRUCTS_H__

#include "ocf_env_headers.h"
#include "../metadata/metadata_cleaning_policy.h"

/* TODO: remove acp metadata */
struct acp_cleaning_policy_meta {
uint8_t dirty : 1;
};

/* cleaning policy per partition metadata */
struct acp_cleaning_policy_config {
uint32_t thread_wakeup_time; /* in milliseconds*/
uint32_t flush_max_buffers; /* in lines */
};

#endif

Expand Down
25 changes: 2 additions & 23 deletions src/cleaning/alru_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,14 @@
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2022 David Lee <live4thee@gmail.com>
* Copyright(c) 2025 Huawei Technologies
* Copyright(c) 2026 Unvertical
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __CLEANING_ALRU_STRUCTS_H__
#define __CLEANING_ALRU_STRUCTS_H__

#include "ocf/ocf.h"
#include "ocf_env.h"
#include "../metadata/metadata_cleaning_policy.h"

struct alru_cleaning_policy_meta {
/* Lru pointers 2*4=8 bytes */
uint32_t timestamp;
uint32_t lru_prev;
uint32_t lru_next;
} __attribute__((packed));

struct alru_cleaning_policy_config {
uint32_t thread_wakeup_time; /* in seconds */
uint32_t stale_buffer_time; /* in seconds */
uint32_t flush_max_buffers; /* in lines */
uint32_t activity_threshold; /* in milliseconds */
uint32_t dirty_ratio_threshold; /* percent */
uint32_t dirty_ratio_inertia; /* bytes */
};

struct alru_cleaning_policy {
env_atomic size;
uint32_t lru_head;
uint32_t lru_tail;
};


#endif
25 changes: 2 additions & 23 deletions src/cleaning/cleaning.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright(c) 2012-2022 Intel Corporation
* Copyright(c) 2023-2025 Huawei Technologies Co., Ltd.
* Copyright(c) 2026 Unvertical
* SPDX-License-Identifier: BSD-3-Clause
*/

Expand All @@ -10,36 +11,14 @@
#include "alru_structs.h"
#include "nop_structs.h"
#include "acp_structs.h"
#include "../metadata/metadata_cleaning_policy.h"
#include "ocf_env_refcnt.h"
#include "ocf/ocf_cleaner.h"

#define CLEANING_POLICY_CONFIG_BYTES 256
#define CLEANING_POLICY_TYPE_MAX 4

#define SLEEP_TIME_MS (1000)

struct ocf_request;

struct cleaning_policy_config {
uint8_t data[CLEANING_POLICY_CONFIG_BYTES];
} __attribute__((aligned(4)));

struct cleaning_policy {
union {
struct nop_cleaning_policy nop;
struct alru_cleaning_policy alru;
} policy;
};

/* Cleaning policy metadata per cache line */
struct cleaning_policy_meta {
union {
struct nop_cleaning_policy_meta nop;
struct alru_cleaning_policy_meta alru;
struct acp_cleaning_policy_meta acp;
} meta;
};

struct ocf_cleaner {
struct env_refcnt refcnt;
ocf_cleaning_t policy;
Expand Down
6 changes: 1 addition & 5 deletions src/cleaning/nop_structs.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
/*
* Copyright(c) 2012-2021 Intel Corporation
* Copyright(c) 2026 Unvertical
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __LAYER_CLEANING_POLICY_NOP_STRUCTS_H__

#define __LAYER_CLEANING_POLICY_NOP_STRUCTS_H__

struct nop_cleaning_policy_meta {
} __attribute__((packed));

struct nop_cleaning_policy {
};

#endif
8 changes: 5 additions & 3 deletions src/concurrency/ocf_pio_concurrency.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/*
* Copyright(c) 2021-2022 Intel Corporation
* Copyright(c) 2022-2024 Huawei Technologies
* Copyright(c) 2026 Unvertical
* SPDX-License-Identifier: BSD-3-Clause
*/

Expand Down Expand Up @@ -225,10 +226,11 @@ int ocf_pio_concurrency_init(struct ocf_alock **self, ocf_cache_t cache)
struct ocf_metadata_raw *raw = &(ctrl->raw_desc[update_segments[i]]);
pio_ctx->segments[i].first_entry = pages_to_alloc;
pio_ctx->segments[i].id = update_segments[i];
pio_ctx->segments[i].begin = raw->ssd_pages_offset;
pio_ctx->segments[i].end = raw->ssd_pages_offset + raw->ssd_pages;
pio_ctx->segments[i].begin = raw->layout->offset;
pio_ctx->segments[i].end = raw->layout->offset +
raw->layout->pages;

pages_to_alloc += raw->ssd_pages;
pages_to_alloc += raw->layout->pages;
}

ret = ocf_alock_init_inplace(alock, pages_to_alloc, name, &ocf_pio_conc_cbs, cache);
Expand Down
Loading
Loading