MCPcopy Create free account
hub / github.com/ceph/ceph / get_pool_stats

Function get_pool_stats

src/librbd/api/Pool.cc:190–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188
189template <typename I>
190int get_pool_stats(librados::IoCtx& io_ctx, const ConfigProxy& config,
191 const std::vector<std::string>& image_ids, uint64_t* image_count,
192 uint64_t* provisioned_bytes, uint64_t* max_provisioned_bytes,
193 uint64_t* snapshot_count) {
194
195 bool scan_snaps = ((max_provisioned_bytes != nullptr) ||
196 (snapshot_count != nullptr));
197
198 SimpleThrottle throttle(
199 config.template get_val<uint64_t>("rbd_concurrent_management_ops"), true);
200 std::atomic<uint64_t> bytes{0};
201 std::atomic<uint64_t> max_bytes{0};
202 std::atomic<uint64_t> snaps{0};
203 for (auto& image_id : image_ids) {
204 if (throttle.pending_error()) {
205 break;
206 }
207
208 auto req = new ImageStatRequest<I>(io_ctx, throttle, image_id,
209 scan_snaps, &bytes, &max_bytes, &snaps);
210 req->send();
211 }
212
213 int r = throttle.wait_for_ret();
214 if (r < 0) {
215 return r;
216 }
217
218 if (image_count != nullptr) {
219 *image_count = image_ids.size();
220 }
221 if (provisioned_bytes != nullptr) {
222 *provisioned_bytes = bytes.load();
223 }
224 if (max_provisioned_bytes != nullptr) {
225 *max_provisioned_bytes = max_bytes.load();
226 }
227 if (snapshot_count != nullptr) {
228 *snapshot_count = snaps.load();
229 }
230
231 return 0;
232}
233
234} // anonymous namespace
235

Callers 1

get_pool_statsMethod · 0.85

Calls 5

pending_errorMethod · 0.80
wait_for_retMethod · 0.80
sendMethod · 0.45
sizeMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected