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"
13 // Performance counters
15 l_librbd_first
= 26000,
17 l_librbd_rd
, // read ops
18 l_librbd_rd_bytes
, // bytes read
19 l_librbd_rd_latency
, // average latency
24 l_librbd_discard_bytes
,
25 l_librbd_discard_latency
,
29 l_librbd_aio_flush_latency
,
40 l_librbd_snap_rollback
,
47 l_librbd_readahead_bytes
,
49 l_librbd_invalidate_cache
,
52 l_librbd_lock_acquired_time
,
57 /** @brief Unique identification of a parent in clone relationship.
58 * Cloning an image creates a child image that keeps a reference
59 * to its parent. This allows copy-on-write images. */
65 ParentSpec() : pool_id(-1), snap_id(CEPH_NOSNAP
) {
67 ParentSpec(int64_t pool_id
, std::string image_id
, snapid_t snap_id
)
68 : pool_id(pool_id
), image_id(image_id
), snap_id(snap_id
) {
71 bool operator==(const ParentSpec
&other
) {
72 return ((this->pool_id
== other
.pool_id
) &&
73 (this->image_id
== other
.image_id
) &&
74 (this->snap_id
== other
.snap_id
));
76 bool operator!=(const ParentSpec
&other
) {
77 return !(*this == other
);
81 /// Full information about an image's parent.
83 /// Identification of the parent.
86 /** @brief Where the portion of data shared with the child image ends.
87 * Since images can be resized multiple times, the portion of data shared
88 * with the child image is not necessarily min(parent size, child size).
89 * If the child image is first shrunk and then enlarged, the common portion
93 ParentInfo() : overlap(0) {
99 cls::rbd::SnapshotNamespace snap_namespace
;
102 uint8_t protection_status
;
105 SnapInfo(std::string _name
,
106 const cls::rbd::SnapshotNamespace
&_snap_namespace
,
107 uint64_t _size
, const ParentInfo
&_parent
,
108 uint8_t _protection_status
, uint64_t _flags
, utime_t _timestamp
)
109 : name(_name
), snap_namespace(_snap_namespace
), size(_size
),
110 parent(_parent
), protection_status(_protection_status
), flags(_flags
),
111 timestamp(_timestamp
) {
115 } // namespace librbd
117 #endif // LIBRBD_TYPES_H