@@ -256,6 +256,9 @@ void BlueFS::_init_logger()
256256 b.add_u64 (l_bluefs_slow_used_bytes, " slow_used_bytes" ,
257257 " Used bytes (slow device)" ,
258258 " slou" , PerfCountersBuilder::PRIO_USEFUL, unit_t (UNIT_BYTES));
259+ b.add_u64 (l_bluefs_meta_ratio, " meta_ratio_micros" ,
260+ " Actual metadata/userdata ratio * 1e3" ,
261+ " mera" , PerfCountersBuilder::PRIO_INTERESTING);
259262 b.add_u64 (l_bluefs_num_files, " num_files" , " File count" ,
260263 " f" , PerfCountersBuilder::PRIO_USEFUL);
261264 b.add_u64 (l_bluefs_log_bytes, " log_bytes" , " Size of the metadata log" ,
@@ -483,6 +486,22 @@ void BlueFS::_update_logger_stats()
483486 logger->set (l_bluefs_slow_total_bytes, _get_block_device_size (BDEV_SLOW));
484487 logger->set (l_bluefs_slow_used_bytes, _get_used (BDEV_SLOW));
485488 }
489+ double r = 0.0 ;
490+ int64_t in_data = 0 ;
491+ int64_t in_meta = 0 ;
492+ in_data = get_used_non_bluefs ();
493+ in_meta = _get_used (BDEV_SLOW) + _get_used (BDEV_DB) + _get_used (BDEV_WAL);
494+ if (in_data > 0 ) {
495+ dout (10 ) << __func__ << " got meta ratio parameters, "
496+ << " data: " << in_data << " , meta: " << in_meta
497+ << dendl;
498+ r = double (in_meta) / double (in_data);
499+ } else {
500+ dout (5 ) << __func__ << " got weird meta ratio parameters, "
501+ << " data: " << in_data << " , meta: " << in_meta
502+ << dendl;
503+ }
504+ logger->set (l_bluefs_meta_ratio, r * 1000 );
486505}
487506
488507int BlueFS::add_block_device (unsigned id, const string& path, bool trim,
@@ -572,6 +591,17 @@ uint64_t BlueFS::get_used()
572591 return used;
573592}
574593
594+ int64_t BlueFS::get_used_non_bluefs ()
595+ {
596+ uint64_t ret = 0 ;
597+ if (shared_alloc_id > 0 && shared_alloc && shared_alloc->a ) {
598+ ret = (int64_t )_get_block_device_size (shared_alloc_id) -
599+ shared_alloc->a ->get_free () -
600+ shared_alloc->bluefs_used ;
601+ }
602+ return ret;
603+ }
604+
575605uint64_t BlueFS::_get_used (unsigned id) const
576606{
577607 uint64_t used = 0 ;
0 commit comments