]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PrimaryLogPG: do not count failed read in delta_stats 25687/head
authorKefu Chai <kchai@redhat.com>
Sun, 23 Dec 2018 14:37:21 +0000 (22:37 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 23 Dec 2018 14:49:53 +0000 (22:49 +0800)
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 <kchai@redhat.com>
src/osd/PrimaryLogPG.cc

index ee30ccc2b7483bdbebec8331d89be7f9eaa2f952..4cc4e85cbd85648488e4f17550b0d1d0fad1bb28 100644 (file)
@@ -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;
 }