2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
6 #ifndef __OCF_VOLUME_PRIV_H__
7 #define __OCF_VOLUME_PRIV_H__
10 #include "ocf_io_priv.h"
11 #include "utils/utils_refcnt.h"
12 #include "utils/utils_io_allocator.h"
14 struct ocf_volume_extended
{
15 ocf_io_allocator_type_t allocator_type
;
18 struct ocf_volume_type
{
19 const struct ocf_volume_properties
*properties
;
20 struct ocf_io_allocator allocator
;
24 ocf_volume_type_t type
;
25 struct ocf_volume_uuid uuid
;
30 struct list_head core_pool_item
;
32 unsigned discard_zeroes
:1;
33 /* true if reading discarded pages returns 0 */
35 struct ocf_refcnt refcnt
;
38 int ocf_volume_type_init(struct ocf_volume_type
**type
,
39 const struct ocf_volume_properties
*properties
,
40 const struct ocf_volume_extended
*extended
);
42 void ocf_volume_type_deinit(struct ocf_volume_type
*type
);
44 void ocf_volume_move(ocf_volume_t volume
, ocf_volume_t from
);
46 void ocf_volume_set_uuid(ocf_volume_t volume
,
47 const struct ocf_volume_uuid
*uuid
);
49 static inline void ocf_volume_submit_metadata(struct ocf_io
*io
)
51 ocf_volume_t volume
= ocf_io_get_volume(io
);
53 ENV_BUG_ON(!volume
->type
->properties
->ops
.submit_metadata
);
55 volume
->type
->properties
->ops
.submit_metadata(io
);
58 static inline void ocf_volume_submit_write_zeroes(struct ocf_io
*io
)
60 ocf_volume_t volume
= ocf_io_get_volume(io
);
62 ENV_BUG_ON(!volume
->type
->properties
->ops
.submit_write_zeroes
);
64 volume
->type
->properties
->ops
.submit_write_zeroes(io
);
67 #endif /*__OCF_VOLUME_PRIV_H__ */