From: Gui Hecheng Date: Tue, 21 Feb 2017 07:21:56 +0000 (+0800) Subject: librbd: handle perfcounter for writesame separately X-Git-Tag: v12.0.1~250^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ca737d0678a62c7510ed4f9cb854423173b05045;p=ceph.git librbd: handle perfcounter for writesame separately Signed-off-by: Gui Hecheng --- diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index d16c0a572561..d16e8c14a878 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -369,6 +369,9 @@ struct C_InvalidateCache : public Context { plb.add_u64_counter(l_librbd_flush, "flush", "Flushes"); plb.add_u64_counter(l_librbd_aio_flush, "aio_flush", "Async flushes"); plb.add_time_avg(l_librbd_aio_flush_latency, "aio_flush_latency", "Latency of async flushes"); + plb.add_u64_counter(l_librbd_ws, "ws", "WriteSames"); + plb.add_u64_counter(l_librbd_ws_bytes, "ws_bytes", "WriteSame data"); + plb.add_time_avg(l_librbd_ws_latency, "ws_latency", "WriteSame latency"); plb.add_u64_counter(l_librbd_snap_create, "snap_create", "Snap creations"); plb.add_u64_counter(l_librbd_snap_remove, "snap_remove", "Snap removals"); plb.add_u64_counter(l_librbd_snap_rollback, "snap_rollback", "Snap rollbacks"); diff --git a/src/librbd/internal.h b/src/librbd/internal.h index 64be3a1810f7..9fed529d016e 100644 --- a/src/librbd/internal.h +++ b/src/librbd/internal.h @@ -33,6 +33,9 @@ enum { l_librbd_aio_flush, l_librbd_aio_flush_latency, + l_librbd_ws, + l_librbd_ws_bytes, + l_librbd_ws_latency, l_librbd_snap_create, l_librbd_snap_remove, diff --git a/src/librbd/io/AioCompletion.cc b/src/librbd/io/AioCompletion.cc index 812fbc9e0e33..ecc0445efdae 100644 --- a/src/librbd/io/AioCompletion.cc +++ b/src/librbd/io/AioCompletion.cc @@ -70,6 +70,8 @@ void AioCompletion::complete() { ictx->perfcounter->tinc(l_librbd_discard_latency, elapsed); break; case AIO_TYPE_FLUSH: ictx->perfcounter->tinc(l_librbd_aio_flush_latency, elapsed); break; + case AIO_TYPE_WRITESAME: + ictx->perfcounter->tinc(l_librbd_ws_latency, elapsed); break; default: lderr(cct) << "completed invalid aio_type: " << aio_type << dendl; break; diff --git a/src/librbd/io/ImageRequest.cc b/src/librbd/io/ImageRequest.cc index 44b6ea1813b5..ee9d9535b2a9 100644 --- a/src/librbd/io/ImageRequest.cc +++ b/src/librbd/io/ImageRequest.cc @@ -804,8 +804,8 @@ ObjectRequestHandle *ImageWriteSameRequest::create_object_request( template void ImageWriteSameRequest::update_stats(size_t length) { I &image_ctx = this->m_image_ctx; - image_ctx.perfcounter->inc(l_librbd_wr); - image_ctx.perfcounter->inc(l_librbd_wr_bytes, length); + image_ctx.perfcounter->inc(l_librbd_ws); + image_ctx.perfcounter->inc(l_librbd_ws_bytes, length); } } // namespace io