Implement asynchronous attach, load, detach and stop
NOTE: This is still not the real asynchronism. Metadata interfaces are still not fully asynchronous. Signed-off-by: Robert Baldyga <robert.baldyga@intel.com> Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
@@ -103,20 +103,20 @@ ocf_cache_line_t ocf_metadata_get_pages_count(struct ocf_cache *cache)
|
||||
return cache->metadata.iface.pages(cache);
|
||||
}
|
||||
|
||||
ocf_cache_line_t
|
||||
ocf_metadata_get_cachelines_count(struct ocf_cache *cache)
|
||||
ocf_cache_line_t ocf_metadata_get_cachelines_count(ocf_cache_t cache)
|
||||
{
|
||||
return cache->metadata.iface.cachelines(cache);
|
||||
}
|
||||
|
||||
int ocf_metadata_flush_all(struct ocf_cache *cache)
|
||||
void ocf_metadata_flush_all(ocf_cache_t cache,
|
||||
ocf_metadata_end_t cmpl, void *priv)
|
||||
{
|
||||
int result;
|
||||
|
||||
OCF_METADATA_LOCK_WR();
|
||||
result = cache->metadata.iface.flush_all(cache);
|
||||
OCF_METADATA_UNLOCK_WR();
|
||||
return result;
|
||||
cmpl(priv, result);
|
||||
}
|
||||
|
||||
void ocf_metadata_flush(struct ocf_cache *cache, ocf_cache_line_t line)
|
||||
@@ -124,19 +124,24 @@ void ocf_metadata_flush(struct ocf_cache *cache, ocf_cache_line_t line)
|
||||
cache->metadata.iface.flush(cache, line);
|
||||
}
|
||||
|
||||
int ocf_metadata_load_all(struct ocf_cache *cache)
|
||||
void ocf_metadata_load_all(ocf_cache_t cache,
|
||||
ocf_metadata_end_t cmpl, void *priv)
|
||||
{
|
||||
int result;
|
||||
|
||||
OCF_METADATA_LOCK_WR();
|
||||
result = cache->metadata.iface.load_all(cache);
|
||||
OCF_METADATA_UNLOCK_WR();
|
||||
return result;
|
||||
cmpl(priv, result);
|
||||
}
|
||||
|
||||
int ocf_metadata_load_recovery(struct ocf_cache *cache)
|
||||
void ocf_metadata_load_recovery(ocf_cache_t cache,
|
||||
ocf_metadata_end_t cmpl, void *priv)
|
||||
{
|
||||
return cache->metadata.iface.load_recovery(cache);
|
||||
int result;
|
||||
|
||||
result = cache->metadata.iface.load_recovery(cache);
|
||||
cmpl(priv, result);
|
||||
}
|
||||
|
||||
void ocf_metadata_flush_mark(struct ocf_cache *cache, struct ocf_request *req,
|
||||
|
@@ -124,6 +124,8 @@ static inline void ocf_metadata_status_bits_unlock(
|
||||
#define OCF_METADATA_FLUSH_UNLOCK() \
|
||||
ocf_metadata_flush_unlock(cache)
|
||||
|
||||
typedef void (*ocf_metadata_end_t)(void *priv, int error);
|
||||
|
||||
#include "metadata_cleaning_policy.h"
|
||||
#include "metadata_eviction_policy.h"
|
||||
#include "metadata_partition.h"
|
||||
@@ -224,10 +226,12 @@ ocf_cache_line_t ocf_metadata_get_pages_count(struct ocf_cache *cache);
|
||||
/**
|
||||
* @brief Flush metadata
|
||||
*
|
||||
* @param cache
|
||||
* @return 0 - Operation success otherwise failure
|
||||
* @param cache - Cache instance
|
||||
* @param cmpl - Completion callback
|
||||
* @param priv - Completion context
|
||||
*/
|
||||
int ocf_metadata_flush_all(struct ocf_cache *cache);
|
||||
void ocf_metadata_flush_all(ocf_cache_t cache,
|
||||
ocf_metadata_end_t cmpl, void *priv);
|
||||
|
||||
|
||||
/**
|
||||
@@ -263,17 +267,21 @@ void ocf_metadata_flush_do_asynch(struct ocf_cache *cache,
|
||||
* @brief Load metadata
|
||||
*
|
||||
* @param cache - Cache instance
|
||||
* @return 0 - Operation success otherwise failure
|
||||
* @param cmpl - Completion callback
|
||||
* @param priv - Completion context
|
||||
*/
|
||||
int ocf_metadata_load_all(struct ocf_cache *cache);
|
||||
void ocf_metadata_load_all(ocf_cache_t cache,
|
||||
ocf_metadata_end_t cmpl, void *priv);
|
||||
|
||||
/**
|
||||
* @brief Load metadata required for recovery procedure
|
||||
*
|
||||
* @param cache Cache instance
|
||||
* @return 0 - Operation success otherwise failure
|
||||
* @param cmpl - Completion callback
|
||||
* @param priv - Completion context
|
||||
*/
|
||||
int ocf_metadata_load_recovery(struct ocf_cache *cache);
|
||||
void ocf_metadata_load_recovery(ocf_cache_t cache,
|
||||
ocf_metadata_end_t cmpl, void *priv);
|
||||
|
||||
/*
|
||||
* NOTE Hash table is specific for hash table metadata service implementation
|
||||
|
@@ -62,17 +62,24 @@ struct ocf_superblock_runtime {
|
||||
uint32_t cleaning_thread_access;
|
||||
};
|
||||
|
||||
static inline int ocf_metadata_set_shutdown_status(
|
||||
struct ocf_cache *cache,
|
||||
enum ocf_metadata_shutdown_status shutdown_status)
|
||||
static inline void ocf_metadata_set_shutdown_status(ocf_cache_t cache,
|
||||
enum ocf_metadata_shutdown_status shutdown_status,
|
||||
ocf_metadata_end_t cmpl, void *priv)
|
||||
{
|
||||
return cache->metadata.iface.set_shutdown_status(cache,
|
||||
int result;
|
||||
|
||||
result = cache->metadata.iface.set_shutdown_status(cache,
|
||||
shutdown_status);
|
||||
cmpl(priv, result);
|
||||
}
|
||||
|
||||
static inline int ocf_metadata_load_superblock(struct ocf_cache *cache)
|
||||
static inline void ocf_metadata_load_superblock(ocf_cache_t cache,
|
||||
ocf_metadata_end_t cmpl, void *priv)
|
||||
{
|
||||
return cache->metadata.iface.load_superblock(cache);
|
||||
int result;
|
||||
|
||||
result = cache->metadata.iface.load_superblock(cache);
|
||||
cmpl(priv, result);
|
||||
}
|
||||
|
||||
static inline
|
||||
|
Reference in New Issue
Block a user