From 93a30efd867ab339650d793ce217d42efab1b728 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sat, 26 Jul 2025 14:11:15 +0300 Subject: [PATCH] Do not use numbered printf args --- src/osd/osd_peering.cpp | 17 ++++++++--------- src/osd/osd_primary_subops.cpp | 17 ++++++++--------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/osd/osd_peering.cpp b/src/osd/osd_peering.cpp index b2bf0439..ffe432cf 100644 --- a/src/osd/osd_peering.cpp +++ b/src/osd/osd_peering.cpp @@ -488,15 +488,14 @@ void osd_t::relock_pg(pg_t & pg) } else if (op->reply.hdr.retval != -EPIPE) { - printf( - (op->reply.hdr.retval == -ENOENT - ? "Failed to %1$s PG %2$u/%3$u on OSD %4$ju - peer didn't load PG info yet\n" - : (op->reply.sec_lock.cur_primary - ? "Failed to %1$s PG %2$u/%3$u on OSD %4$ju - taken by OSD %6$ju (retval=%5$jd)\n" - : "Failed to %1$s PG %2$u/%3$u on OSD %4$ju - retval=%5$jd\n")), - op->req.sec_lock.flags == OSD_SEC_UNLOCK_PG ? "unlock" : "lock", - pg_id.pool_id, pg_id.pg_num, peer_osd, op->reply.hdr.retval, op->reply.sec_lock.cur_primary - ); + printf("Failed to %s PG %u/%u on OSD %ju - ", op->req.sec_lock.flags == OSD_SEC_UNLOCK_PG ? "unlock" : "lock", + pg_id.pool_id, pg_id.pg_num, peer_osd); + if (op->reply.hdr.retval == -ENOENT) + printf("peer didn't load PG info yet\n"); + else if (op->reply.sec_lock.cur_primary) + printf("taken by OSD %ju (retval=%jd)\n", op->reply.sec_lock.cur_primary, op->reply.hdr.retval); + else + printf("retval=%jd\n", op->reply.hdr.retval); // Retry relocking/unlocking PG after a short time pg.lock_waiting = true; tfd->set_timer(pg_lock_retry_interval_ms, false, [this, pg_id](int) diff --git a/src/osd/osd_primary_subops.cpp b/src/osd/osd_primary_subops.cpp index 244a42f9..06569e0e 100644 --- a/src/osd/osd_primary_subops.cpp +++ b/src/osd/osd_primary_subops.cpp @@ -420,15 +420,14 @@ void osd_t::handle_primary_subop(osd_op_t *subop, osd_op_t *cur_op) ? msgr.clients[subop->peer_fd]->osd_num : 0); if (opcode == OSD_OP_SEC_READ || opcode == OSD_OP_SEC_WRITE || opcode == OSD_OP_SEC_WRITE_STABLE) { - printf( - subop->peer_fd >= 0 - ? (peer_osd > 0 - ? "%1$s subop to %2$jx:%3$jx v%4$ju failed on osd %7$ju: retval = %5$d (expected %6$d)\n" - : "%1$s subop to %2$jx:%3$jx v%4$ju failed on peer %8$d: retval = %5$d (expected %6$d)\n") - : "%1$s subop to %2$jx:%3$jx v%4$ju failed locally: retval = %5$d (expected %6$d)\n", - osd_op_names[opcode], subop->req.sec_rw.oid.inode, subop->req.sec_rw.oid.stripe, subop->req.sec_rw.version, - retval, expected, peer_osd, subop->peer_fd - ); + printf("%s subop to %jx:%jx v%ju failed ", osd_op_names[opcode], + subop->req.sec_rw.oid.inode, subop->req.sec_rw.oid.stripe, subop->req.sec_rw.version); + if (subop->peer_fd >= 0 && peer_osd > 0) + printf("on osd %ju: retval = %d (expected %d)\n", peer_osd, retval, expected); + else if (peer_osd > 0) + printf("on peer %d: retval = %d (expected %d)\n", subop->peer_fd, retval, expected); + else + printf("locally: retval = %d (expected %d)\n", retval, expected); } else if (opcode == OSD_OP_SEC_DELETE) {