From 18a518615e56279d7891a0dd861f268dd1798dab Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 23 Dec 2018 22:37:21 +0800 Subject: [PATCH] osd/PrimaryLogPG: do not count failed read in delta_stats ctx->delta_stats is accumulated to PG.info.stats.stats in ReplicatedBackend::submit_transaction() before queueing the transaction. and `stats` is used for stats reporting. so i think we should not take the failed ops into account. Signed-off-by: Kefu Chai --- src/osd/PrimaryLogPG.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index ee30ccc2b7483..4cc4e85cbd856 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -5519,10 +5519,7 @@ int PrimaryLogPG::do_read(OpContext *ctx, OSDOp& osd_op) { if (r >= 0) op.extent.length = r; else if (r == -EAGAIN) { - // EAGAIN should not change the length of extent or count the read op. - dout(10) << " read got " << r << " / " << op.extent.length - << " bytes from obj " << soid << ". try again." << dendl; - return -EAGAIN; + result = -EAGAIN; } else { result = r; op.extent.length = 0; @@ -5530,11 +5527,10 @@ int PrimaryLogPG::do_read(OpContext *ctx, OSDOp& osd_op) { dout(10) << " read got " << r << " / " << op.extent.length << " bytes from obj " << soid << dendl; } - - // XXX the op.extent.length is the requested length for async read - // On error this length is changed to 0 after the error comes back. - ctx->delta_stats.num_rd_kb += shift_round_up(op.extent.length, 10); - ctx->delta_stats.num_rd++; + if (result >= 0) { + ctx->delta_stats.num_rd_kb += shift_round_up(op.extent.length, 10); + ctx->delta_stats.num_rd++; + } return result; } -- 2.39.5