@@ -774,9 +774,6 @@ bool GCManager::pdev_gc_actor::copy_valid_data(
774774 */
775775 }
776776#endif
777-
778- // for emergent gc, we directly use the current shard header as the new header
779-
780777 // TODO::involve ratelimiter in the following code, where read/write are scheduled. or do we need a central
781778 // ratelimter shared by all components except client io?
782779 auto succeed_copying_shard =
@@ -786,6 +783,8 @@ bool GCManager::pdev_gc_actor::copy_valid_data(
786783 &valid_blob_indexes, &data_service, task_id, &last_shard_state, &copied_blobs, pg_id,
787784 header_sgs = std::move (header_sgs)](auto && err) {
788785 RELEASE_ASSERT (header_sgs.iovs .size () == 1 , " header_sgs.iovs.size() should be 1, but not!" );
786+ // shard header occupies one blk
787+ COUNTER_INCREMENT (metrics_, gc_write_blk_count, 1 );
789788 iomanager.iobuf_free (reinterpret_cast < uint8_t * >(header_sgs.iovs [0 ].iov_base ));
790789 if (err) {
791790 GCLOGE (task_id, pg_id, shard_id,
@@ -822,6 +821,7 @@ bool GCManager::pdev_gc_actor::copy_valid_data(
822821 data_service.async_read (pba, data_sgs, total_size)
823822 .thenValue ([this , k, &hints, &move_from_chunk, &move_to_chunk, &data_service, task_id,
824823 pg_id, data_sgs = std::move (data_sgs), pba, &copied_blobs](auto && err) {
824+ COUNTER_INCREMENT (metrics_, gc_read_blk_count, pba.blk_count ());
825825 RELEASE_ASSERT (data_sgs.iovs .size () == 1 ,
826826 " data_sgs.iovs.size() should be 1, but not!" );
827827
@@ -865,6 +865,7 @@ bool GCManager::pdev_gc_actor::copy_valid_data(
865865 return data_service.async_alloc_write (data_sgs, hints, new_pba)
866866 .thenValue ([this , shard_id, blob_id, new_pba, &move_to_chunk, task_id, pg_id,
867867 &copied_blobs, data_sgs = std::move (data_sgs)](auto && err) {
868+ COUNTER_INCREMENT (metrics_, gc_write_blk_count, new_pba.blk_count ());
868869 RELEASE_ASSERT (data_sgs.iovs .size () == 1 ,
869870 " data_sgs.iovs.size() should be 1, but not!" );
870871 iomanager.iobuf_free (
@@ -937,8 +938,9 @@ bool GCManager::pdev_gc_actor::copy_valid_data(
937938 return folly::makeFuture< std::error_code >(std::error_code{});
938939 }
939940
940- // write shard footer
941+ // write shard footer, which occupies one blk
941942 homestore::MultiBlkId out_blkids;
943+ COUNTER_INCREMENT (metrics_, gc_write_blk_count, 1 );
942944 return data_service.async_alloc_write (footer_sgs, hints, out_blkids);
943945 })
944946 .thenValue ([this , &move_to_chunk, &shard_id, footer_sgs, task_id, pg_id](auto && err) {
0 commit comments