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) {
std::cerr << "\r" << operation << ": "
<< pc << "% complete..." << std::flush;
}
}
+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 =