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"
15 // Performance counters
17 l_librbd_first
= 26000,
19 l_librbd_rd
, // read ops
20 l_librbd_rd_bytes
, // bytes read
21 l_librbd_rd_latency
, // average latency
26 l_librbd_discard_bytes
,
27 l_librbd_discard_latency
,
29 l_librbd_flush_latency
,
41 l_librbd_snap_rollback
,
48 l_librbd_readahead_bytes
,
50 l_librbd_invalidate_cache
,
53 l_librbd_lock_acquired_time
,
58 typedef std::map
<uint64_t, uint64_t> SnapSeqs
;
60 /// Full information about an image's parent.
61 struct ParentImageInfo
{
62 /// Identification of the parent.
63 cls::rbd::ParentImageSpec spec
;
65 /** @brief Where the portion of data shared with the child image ends.
66 * Since images can be resized multiple times, the portion of data shared
67 * with the child image is not necessarily min(parent size, child size).
68 * If the child image is first shrunk and then enlarged, the common portion
75 cls::rbd::SnapshotNamespace snap_namespace
;
77 ParentImageInfo parent
;
78 uint8_t protection_status
;
81 SnapInfo(std::string _name
,
82 const cls::rbd::SnapshotNamespace
&_snap_namespace
,
83 uint64_t _size
, const ParentImageInfo
&_parent
,
84 uint8_t _protection_status
, uint64_t _flags
, utime_t _timestamp
)
85 : name(_name
), snap_namespace(_snap_namespace
), size(_size
),
86 parent(_parent
), protection_status(_protection_status
), flags(_flags
),
87 timestamp(_timestamp
) {
92 OPEN_FLAG_SKIP_OPEN_PARENT
= 1 << 0,
93 OPEN_FLAG_OLD_FORMAT
= 1 << 1,
94 OPEN_FLAG_IGNORE_MIGRATING
= 1 << 2
97 struct MigrationInfo
{
99 std::string pool_namespace
;
100 std::string image_name
;
101 std::string image_id
;
102 deep_copy::SnapMap snap_map
;
103 uint64_t overlap
= 0;
104 bool flatten
= false;
108 MigrationInfo(int64_t pool_id
, const std::string
& pool_namespace
,
109 const std::string
& image_name
, const std::string
& image_id
,
110 const deep_copy::SnapMap
&snap_map
, uint64_t overlap
,
112 : pool_id(pool_id
), pool_namespace(pool_namespace
), image_name(image_name
),
113 image_id(image_id
), snap_map(snap_map
), overlap(overlap
),
118 return pool_id
== -1;
122 } // namespace librbd
124 #endif // LIBRBD_TYPES_H