From: Kefu Chai Date: Sun, 23 Dec 2018 14:37:21 +0000 (+0800) Subject: osd/PrimaryLogPG: do not count failed read in delta_stats X-Git-Tag: v14.1.0~520^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F25687%2Fhead;p=ceph.git 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 --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index ee30ccc2b748..4cc4e85cbd85 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; }