1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
7 #include "include/types.h"
8 #include "cls/rbd/cls_rbd_types.h"
9 #include "deep_copy/Types.h"
14 namespace neorados
{ class IOContext
; }
18 // Performance counters
20 l_librbd_first
= 26000,
22 l_librbd_rd
, // read ops
23 l_librbd_rd_bytes
, // bytes read
24 l_librbd_rd_latency
, // average latency
29 l_librbd_discard_bytes
,
30 l_librbd_discard_latency
,
32 l_librbd_flush_latency
,
44 l_librbd_snap_rollback
,
51 l_librbd_readahead_bytes
,
53 l_librbd_invalidate_cache
,
56 l_librbd_lock_acquired_time
,
61 typedef std::shared_ptr
<neorados::IOContext
> IOContext
;
63 typedef std::map
<uint64_t, uint64_t> SnapSeqs
;
65 /// Full information about an image's parent.
66 struct ParentImageInfo
{
67 /// Identification of the parent.
68 cls::rbd::ParentImageSpec spec
;
70 /** @brief Where the portion of data shared with the child image ends.
71 * Since images can be resized multiple times, the portion of data shared
72 * with the child image is not necessarily min(parent size, child size).
73 * If the child image is first shrunk and then enlarged, the common portion
80 cls::rbd::SnapshotNamespace snap_namespace
;
82 ParentImageInfo parent
;
83 uint8_t protection_status
;
86 SnapInfo(std::string _name
,
87 const cls::rbd::SnapshotNamespace
&_snap_namespace
,
88 uint64_t _size
, const ParentImageInfo
&_parent
,
89 uint8_t _protection_status
, uint64_t _flags
, utime_t _timestamp
)
90 : name(_name
), snap_namespace(_snap_namespace
), size(_size
),
91 parent(_parent
), protection_status(_protection_status
), flags(_flags
),
92 timestamp(_timestamp
) {
97 OPEN_FLAG_SKIP_OPEN_PARENT
= 1 << 0,
98 OPEN_FLAG_OLD_FORMAT
= 1 << 1,
99 OPEN_FLAG_IGNORE_MIGRATING
= 1 << 2
102 enum ImageReadOnlyFlag
{
103 IMAGE_READ_ONLY_FLAG_USER
= 1 << 0,
104 IMAGE_READ_ONLY_FLAG_NON_PRIMARY
= 1 << 1,
107 enum SnapCreateFlag
{
108 SNAP_CREATE_FLAG_SKIP_OBJECT_MAP
= 1 << 0,
109 SNAP_CREATE_FLAG_SKIP_NOTIFY_QUIESCE
= 1 << 1,
110 SNAP_CREATE_FLAG_IGNORE_NOTIFY_QUIESCE_ERROR
= 1 << 2,
113 struct MigrationInfo
{
114 int64_t pool_id
= -1;
115 std::string pool_namespace
;
116 std::string image_name
;
117 std::string image_id
;
118 std::string source_spec
;
119 deep_copy::SnapMap snap_map
;
120 uint64_t overlap
= 0;
121 bool flatten
= false;
125 MigrationInfo(int64_t pool_id
, const std::string
& pool_namespace
,
126 const std::string
& image_name
, const std::string
& image_id
,
127 const std::string
& source_spec
,
128 const deep_copy::SnapMap
&snap_map
, uint64_t overlap
,
130 : pool_id(pool_id
), pool_namespace(pool_namespace
), image_name(image_name
),
131 image_id(image_id
), source_spec(source_spec
), snap_map(snap_map
),
132 overlap(overlap
), flatten(flatten
) {
136 return (pool_id
== -1 && source_spec
.empty());
140 } // namespace librbd
142 #endif // LIBRBD_TYPES_H