Merge pull request #835 from mmichal10/composite-improvements
Composite improvements
This commit is contained in:
commit
d8994e886e
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright(c) 2022 Intel Corporation
|
* Copyright(c) 2022 Intel Corporation
|
||||||
|
* Copyright(c) 2024 Huawei Technologies
|
||||||
* SPDX-License-Identifier: BSD-3-Clause
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -54,4 +55,19 @@ int ocf_composite_volume_add(ocf_composite_volume_t cvolume,
|
|||||||
ocf_volume_type_t type, struct ocf_volume_uuid *uuid,
|
ocf_volume_type_t type, struct ocf_volume_uuid *uuid,
|
||||||
void *volume_params);
|
void *volume_params);
|
||||||
|
|
||||||
|
typedef int (*ocf_composite_volume_member_visitor_t)(ocf_volume_t subvolume,
|
||||||
|
void *priv);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Call @visitor on every valid member of composite volume
|
||||||
|
*
|
||||||
|
* @param[in] cvolume composite volume handle
|
||||||
|
* @param[in] visitor function callback
|
||||||
|
* @param[in] priv pointer to be passed to the callback
|
||||||
|
*
|
||||||
|
* @return subvolume in composite volume
|
||||||
|
*/
|
||||||
|
int ocf_composite_volume_member_visit(ocf_composite_volume_t cvolume,
|
||||||
|
ocf_composite_volume_member_visitor_t visitor, void *priv);
|
||||||
|
|
||||||
#endif /* __OCF_COMPOSITE_VOLUME_H__ */
|
#endif /* __OCF_COMPOSITE_VOLUME_H__ */
|
||||||
|
@ -393,3 +393,19 @@ int ocf_composite_volume_add(ocf_composite_volume_t cvolume,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ocf_composite_volume_member_visit(ocf_composite_volume_t cvolume,
|
||||||
|
ocf_composite_volume_member_visitor_t visitor, void *priv)
|
||||||
|
{
|
||||||
|
struct ocf_composite_volume *composite = ocf_volume_get_priv(cvolume);
|
||||||
|
int i;
|
||||||
|
int res;
|
||||||
|
|
||||||
|
for (i = 0 ; i < composite->members_cnt; i++) {
|
||||||
|
res = visitor(&composite->member[i].volume, priv);
|
||||||
|
if (res != 0)
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -29,7 +29,10 @@ struct ocf_volume {
|
|||||||
/* true if reading discarded pages returns 0 */
|
/* true if reading discarded pages returns 0 */
|
||||||
} features;
|
} features;
|
||||||
bool opened;
|
bool opened;
|
||||||
|
|
||||||
bool uuid_copy;
|
bool uuid_copy;
|
||||||
|
/* @brief True if OCF shall free UUID on volume deinit */
|
||||||
|
|
||||||
void *priv;
|
void *priv;
|
||||||
ocf_cache_t cache;
|
ocf_cache_t cache;
|
||||||
struct list_head core_pool_item;
|
struct list_head core_pool_item;
|
||||||
|
Loading…
Reference in New Issue
Block a user