int ProgressContext::update_progress(uint64_t offset, uint64_t total) {
if (progress) {
- int pc = total ? (offset * 100ull / total) : 0;
+ int pc = get_percentage(offset, total);
if (pc > last_pc) {
cerr << "\r" << operation << ": "
<< pc << "% complete...";
}
}
+int get_percentage(uint64_t part, uint64_t whole) {
+ return whole ? (100 * part / whole) : 0;
+}
+
void aio_context_callback(librbd::completion_t completion, void *arg)
{
librbd::RBD::AioCompletion *aio_completion =
void fail();
};
+int get_percentage(uint64_t part, uint64_t whole);
+
template <typename T, void(T::*MF)(int)>
librbd::RBD::AioCompletion *create_aio_completion(T *t) {
return new librbd::RBD::AioCompletion(