diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 16:45:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-23 16:45:13 +0000 |
commit | 389020e14594e4894e28d1eb9103c210b142509e (patch) | |
tree | 2ba734cdd7a243f46dda7c3d0cc88c2293d9699f /src/include | |
parent | Adding upstream version 18.2.2. (diff) | |
download | ceph-389020e14594e4894e28d1eb9103c210b142509e.tar.xz ceph-389020e14594e4894e28d1eb9103c210b142509e.zip |
Adding upstream version 18.2.3.upstream/18.2.3
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/ceph_fs.h | 3 | ||||
-rw-r--r-- | src/include/encoding.h | 49 | ||||
-rw-r--r-- | src/include/intarith.h | 4 | ||||
-rw-r--r-- | src/include/lru.h | 4 | ||||
-rw-r--r-- | src/include/rados/librados.hpp | 7 |
5 files changed, 52 insertions, 15 deletions
diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index 28440c820..245421680 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -290,6 +290,9 @@ struct ceph_mon_subscribe_ack { #define CEPH_MDSMAP_ALLOW_STANDBY_REPLAY (1<<5) /* cluster alllowed to enable MULTIMDS */ #define CEPH_MDSMAP_REFUSE_CLIENT_SESSION (1<<6) /* cluster allowed to refuse client session request */ +#define CEPH_MDSMAP_REFUSE_STANDBY_FOR_ANOTHER_FS (1<<7) /* fs is forbidden to use standby + for another fs */ +#define CEPH_MDSMAP_BALANCE_AUTOMATE (1<<8) /* automate metadata balancing */ #define CEPH_MDSMAP_DEFAULTS (CEPH_MDSMAP_ALLOW_SNAPS | \ CEPH_MDSMAP_ALLOW_MULTIMDS_SNAPS) diff --git a/src/include/encoding.h b/src/include/encoding.h index 40ba9d39c..08c67c33e 100644 --- a/src/include/encoding.h +++ b/src/include/encoding.h @@ -14,6 +14,7 @@ #ifndef CEPH_ENCODING_H #define CEPH_ENCODING_H +#include <concepts> #include <set> #include <map> #include <deque> @@ -322,10 +323,11 @@ inline void decode_nohead(int len, bufferlist& s, bufferlist::const_iterator& p) p.copy(len, s); } -// Time, since the templates are defined in std::chrono +// Time, since the templates are defined in std::chrono. The default encodings +// for time_point and duration are backward-compatible with utime_t, but +// truncate seconds to 32 bits so are not guaranteed to round-trip. -template<typename Clock, typename Duration, - typename std::enable_if_t<converts_to_timespec_v<Clock>>* = nullptr> +template<clock_with_timespec Clock, typename Duration> void encode(const std::chrono::time_point<Clock, Duration>& t, ceph::bufferlist &bl) { auto ts = Clock::to_timespec(t); @@ -336,8 +338,7 @@ void encode(const std::chrono::time_point<Clock, Duration>& t, encode(ns, bl); } -template<typename Clock, typename Duration, - typename std::enable_if_t<converts_to_timespec_v<Clock>>* = nullptr> +template<clock_with_timespec Clock, typename Duration> void decode(std::chrono::time_point<Clock, Duration>& t, bufferlist::const_iterator& p) { uint32_t s; @@ -351,8 +352,7 @@ void decode(std::chrono::time_point<Clock, Duration>& t, t = Clock::from_timespec(ts); } -template<typename Rep, typename Period, - typename std::enable_if_t<std::is_integral_v<Rep>>* = nullptr> +template<std::integral Rep, typename Period> void encode(const std::chrono::duration<Rep, Period>& d, ceph::bufferlist &bl) { using namespace std::chrono; @@ -362,8 +362,7 @@ void encode(const std::chrono::duration<Rep, Period>& d, encode(ns, bl); } -template<typename Rep, typename Period, - typename std::enable_if_t<std::is_integral_v<Rep>>* = nullptr> +template<std::integral Rep, typename Period> void decode(std::chrono::duration<Rep, Period>& d, bufferlist::const_iterator& p) { int32_t s; @@ -373,6 +372,38 @@ void decode(std::chrono::duration<Rep, Period>& d, d = std::chrono::seconds(s) + std::chrono::nanoseconds(ns); } +// Provide encodings for chrono::time_point and duration that use +// the underlying representation so are guaranteed to round-trip. + +template <std::integral Rep, typename Period> +void round_trip_encode(const std::chrono::duration<Rep, Period>& d, + ceph::bufferlist &bl) { + const Rep r = d.count(); + encode(r, bl); +} + +template <std::integral Rep, typename Period> +void round_trip_decode(std::chrono::duration<Rep, Period>& d, + bufferlist::const_iterator& p) { + Rep r; + decode(r, p); + d = std::chrono::duration<Rep, Period>(r); +} + +template <typename Clock, typename Duration> +void round_trip_encode(const std::chrono::time_point<Clock, Duration>& t, + ceph::bufferlist &bl) { + round_trip_encode(t.time_since_epoch(), bl); +} + +template <typename Clock, typename Duration> +void round_trip_decode(std::chrono::time_point<Clock, Duration>& t, + bufferlist::const_iterator& p) { + Duration dur; + round_trip_decode(dur, p); + t = std::chrono::time_point<Clock, Duration>(dur); +} + // ----------------------------- // STL container types diff --git a/src/include/intarith.h b/src/include/intarith.h index 68b0345a4..92f827d88 100644 --- a/src/include/intarith.h +++ b/src/include/intarith.h @@ -25,6 +25,10 @@ constexpr inline std::make_unsigned_t<std::common_type_t<T, U>> div_round_up(T n return (n + d - 1) / d; } +template<typename T, typename U> +constexpr inline std::make_unsigned_t<std::common_type_t<T, U>> round_down_to(T n, U d) { + return n - n % d; +} template<typename T, typename U> constexpr inline std::make_unsigned_t<std::common_type_t<T, U>> round_up_to(T n, U d) { diff --git a/src/include/lru.h b/src/include/lru.h index 3f5069ee3..33f2f4e08 100644 --- a/src/include/lru.h +++ b/src/include/lru.h @@ -185,10 +185,6 @@ public: return NULL; } - void lru_status() { - //generic_dout(10) << "lru: " << lru_get_size() << " items, " << top.size() << " top, " << bottom.size() << " bot, " << pintail.size() << " pintail" << dendl; - } - protected: // adjust top/bot balance, as necessary void adjust() { diff --git a/src/include/rados/librados.hpp b/src/include/rados/librados.hpp index cb8261af1..2cd418627 100644 --- a/src/include/rados/librados.hpp +++ b/src/include/rados/librados.hpp @@ -1477,8 +1477,11 @@ inline namespace v14_2_0 { int get_pool_stats(std::list<std::string>& v, std::string& category, std::map<std::string, stats_map>& stats); - /// check if pool has selfmanaged snaps - bool get_pool_is_selfmanaged_snaps_mode(const std::string& poolname); + + /// check if pool has or had selfmanaged snaps + bool get_pool_is_selfmanaged_snaps_mode(const std::string& poolname) + __attribute__ ((deprecated)); + int pool_is_in_selfmanaged_snaps_mode(const std::string& poolname); int cluster_stat(cluster_stat_t& result); int cluster_fsid(std::string *fsid); |