* Copyright (c) 2024 Huawei Technologies Co.,Ltd.
*
* DSS is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* -------------------------------------------------------------------------
*
* dss_block_ctrl.h
*
*
* IDENTIFICATION
* src/common/persist/dss_block_ctrl.h
*
* -------------------------------------------------------------------------
*/
#ifndef __DSS_BLOCK_CTRL_H
#define __DSS_BLOCK_CTRL_H
#include "dss_defs.h"
#include "dss_au.h"
#include "cm_latch.h"
#include "cm_bilist.h"
#include "dss_shm.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum en_dss_block_type {
DSS_BLOCK_TYPE_FT,
DSS_BLOCK_TYPE_FS,
DSS_BLOCK_TYPE_FS_AUX,
DSS_BLOCK_TYPE_MAX,
} dss_block_type_t;
#pragma pack(8)
typedef union st_dss_fs_block_cache_info {
struct {
char *entry_block_addr;
char *fs_block_addr;
char *fs_aux_addr;
uint64 entry_block_id;
uint64 fs_block_id;
uint64 fs_aux_block_id;
uint32 owner_vg_id;
uint32 owner_ftid_cache_index;
};
struct {
char *owner_node_addr;
uint64 owner_node_id;
};
} dss_fs_block_cache_info_t;
typedef struct st_dss_block_ctrl {
latch_t latch;
dss_block_type_t type;
dss_block_id_t block_id;
sh_mem_p hash_next;
sh_mem_p hash_prev;
uint32_t hash;
bool32 has_next;
bool32 has_prev;
ga_obj_id_t my_obj_id;
bool32 is_refresh_ftid;
uint64 fid;
uint64 ftid;
uint64 file_ver;
char *node;
uint64 bg_task_ref_cnt;
bool32 reserve;
dss_fs_block_cache_info_t fs_block_cache_info;
int64 syn_meta_ref_cnt;
bilist_node_t syn_meta_node;
int64 ref_hot;
bilist_node_t recycle_meta_node;
bool8 recycle_disable;
} dss_block_ctrl_t;
typedef struct st_dss_block_ctrl_task_desc_t {
latch_t latch;
bilist_t bilist;
void *task_args;
} dss_block_ctrl_task_desc_t;
#pragma pack()
#ifdef __cplusplus
}
#endif
#endif