Allows for using shared memory in memory pools. Adds API for accessing such pools after dirty shutdown (claiming them, ie. marking an entry as actively used; calling the ftl_mempool_initialize_ext will reclaim all unused entries back to the pool). Also introduces API for accessing objects, since using direct pointers is not possible (as addresses may change inbetween application startups). Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com> Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com> Change-Id: I5325b39d68aef7e231945cee9d92c925cab2fb2a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13346 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
47 lines
964 B
C
47 lines
964 B
C
/* SPDX-License-Identifier: BSD-3-Clause
|
|
* Copyright (c) Intel Corporation.
|
|
* All rights reserved.
|
|
*/
|
|
|
|
#ifndef FTL_DF_H
|
|
#define FTL_DF_H
|
|
|
|
#include "spdk/stdinc.h"
|
|
|
|
/* Durable format (df) object is an offset */
|
|
typedef uint64_t ftl_df_obj_id;
|
|
|
|
#define FTL_DF_OBJ_ID_INVALID ((ftl_df_obj_id)-1)
|
|
|
|
/**
|
|
* @brief Convert df object ptr to df object id
|
|
*
|
|
* @param base allocation base address
|
|
* @param df_obj_ptr df object ptr
|
|
*
|
|
* @return df object id
|
|
*/
|
|
static inline ftl_df_obj_id
|
|
ftl_df_get_obj_id(void *base, void *df_obj_ptr)
|
|
{
|
|
assert(base <= df_obj_ptr);
|
|
return ((char *)df_obj_ptr - (char *)base);
|
|
}
|
|
|
|
/**
|
|
* @brief Convert df object id to df object ptr
|
|
*
|
|
* @param base allocation base address
|
|
* @param df_obj_id df object id
|
|
*
|
|
* @return df object ptr
|
|
*/
|
|
static inline void *
|
|
ftl_df_get_obj_ptr(void *base, ftl_df_obj_id df_obj_id)
|
|
{
|
|
assert(df_obj_id != FTL_DF_OBJ_ID_INVALID);
|
|
return ((char *)base + df_obj_id);
|
|
}
|
|
|
|
#endif /* FTL_DF_H */
|