@@ -146,26 +146,30 @@ static int mdsc_show(struct seq_file *s, void *p)
146146 name, total, avg, _min, max, sum); \
147147}
148148
149- static int metric_show (struct seq_file * s , void * p )
149+ static int metrics_file_show (struct seq_file * s , void * p )
150150{
151151 struct ceph_fs_client * fsc = s -> private ;
152- struct ceph_mds_client * mdsc = fsc -> mdsc ;
153- struct ceph_client_metric * m = & mdsc -> metric ;
154- int nr_caps = 0 ;
155- s64 total , sum , avg , min , max , sq ;
156- u64 sum_sz , avg_sz , min_sz , max_sz ;
152+ struct ceph_client_metric * m = & fsc -> mdsc -> metric ;
157153
158- sum = percpu_counter_sum (& m -> total_inodes );
159154 seq_printf (s , "item total\n" );
160155 seq_printf (s , "------------------------------------------\n" );
161- seq_printf (s , "%-35s%lld / %lld\n" , "opened files / total inodes" ,
162- atomic64_read (& m -> opened_files ), sum );
163- seq_printf (s , "%-35s%lld / %lld\n" , "pinned i_caps / total inodes" ,
164- atomic64_read (& m -> total_caps ), sum );
165- seq_printf (s , "%-35s%lld / %lld\n" , "opened inodes / total inodes" ,
166- percpu_counter_sum (& m -> opened_inodes ), sum );
167-
168- seq_printf (s , "\n" );
156+ seq_printf (s , "%-35s%lld\n" , "total inodes" ,
157+ percpu_counter_sum (& m -> total_inodes ));
158+ seq_printf (s , "%-35s%lld\n" , "opened files" ,
159+ atomic64_read (& m -> opened_files ));
160+ seq_printf (s , "%-35s%lld\n" , "pinned i_caps" ,
161+ atomic64_read (& m -> total_caps ));
162+ seq_printf (s , "%-35s%lld\n" , "opened inodes" ,
163+ percpu_counter_sum (& m -> opened_inodes ));
164+ return 0 ;
165+ }
166+
167+ static int metrics_latency_show (struct seq_file * s , void * p )
168+ {
169+ struct ceph_fs_client * fsc = s -> private ;
170+ struct ceph_client_metric * m = & fsc -> mdsc -> metric ;
171+ s64 total , sum , avg , min , max , sq ;
172+
169173 seq_printf (s , "item total avg_lat(us) min_lat(us) max_lat(us) stdev(us)\n" );
170174 seq_printf (s , "-----------------------------------------------------------------------------------\n" );
171175
@@ -199,7 +203,16 @@ static int metric_show(struct seq_file *s, void *p)
199203 spin_unlock (& m -> metadata_metric_lock );
200204 CEPH_LAT_METRIC_SHOW ("metadata" , total , avg , min , max , sq );
201205
202- seq_printf (s , "\n" );
206+ return 0 ;
207+ }
208+
209+ static int metrics_size_show (struct seq_file * s , void * p )
210+ {
211+ struct ceph_fs_client * fsc = s -> private ;
212+ struct ceph_client_metric * m = & fsc -> mdsc -> metric ;
213+ s64 total ;
214+ u64 sum_sz , avg_sz , min_sz , max_sz ;
215+
203216 seq_printf (s , "item total avg_sz(bytes) min_sz(bytes) max_sz(bytes) total_sz(bytes)\n" );
204217 seq_printf (s , "----------------------------------------------------------------------------------------\n" );
205218
@@ -221,7 +234,15 @@ static int metric_show(struct seq_file *s, void *p)
221234 spin_unlock (& m -> write_metric_lock );
222235 CEPH_SZ_METRIC_SHOW ("write" , total , avg_sz , min_sz , max_sz , sum_sz );
223236
224- seq_printf (s , "\n" );
237+ return 0 ;
238+ }
239+
240+ static int metrics_caps_show (struct seq_file * s , void * p )
241+ {
242+ struct ceph_fs_client * fsc = s -> private ;
243+ struct ceph_client_metric * m = & fsc -> mdsc -> metric ;
244+ int nr_caps = 0 ;
245+
225246 seq_printf (s , "item total miss hit\n" );
226247 seq_printf (s , "-------------------------------------------------\n" );
227248
@@ -350,8 +371,11 @@ DEFINE_SHOW_ATTRIBUTE(mdsmap);
350371DEFINE_SHOW_ATTRIBUTE (mdsc );
351372DEFINE_SHOW_ATTRIBUTE (caps );
352373DEFINE_SHOW_ATTRIBUTE (mds_sessions );
353- DEFINE_SHOW_ATTRIBUTE (metric );
354374DEFINE_SHOW_ATTRIBUTE (status );
375+ DEFINE_SHOW_ATTRIBUTE (metrics_file );
376+ DEFINE_SHOW_ATTRIBUTE (metrics_latency );
377+ DEFINE_SHOW_ATTRIBUTE (metrics_size );
378+ DEFINE_SHOW_ATTRIBUTE (metrics_caps );
355379
356380
357381/*
@@ -385,8 +409,9 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)
385409 debugfs_remove (fsc -> debugfs_mdsmap );
386410 debugfs_remove (fsc -> debugfs_mds_sessions );
387411 debugfs_remove (fsc -> debugfs_caps );
388- debugfs_remove (fsc -> debugfs_metric );
412+ debugfs_remove (fsc -> debugfs_status );
389413 debugfs_remove (fsc -> debugfs_mdsc );
414+ debugfs_remove_recursive (fsc -> debugfs_metrics_dir );
390415}
391416
392417void ceph_fs_debugfs_init (struct ceph_fs_client * fsc )
@@ -426,12 +451,6 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
426451 fsc ,
427452 & mdsc_fops );
428453
429- fsc -> debugfs_metric = debugfs_create_file ("metrics" ,
430- 0400 ,
431- fsc -> client -> debugfs_dir ,
432- fsc ,
433- & metric_fops );
434-
435454 fsc -> debugfs_caps = debugfs_create_file ("caps" ,
436455 0400 ,
437456 fsc -> client -> debugfs_dir ,
@@ -443,6 +462,18 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
443462 fsc -> client -> debugfs_dir ,
444463 fsc ,
445464 & status_fops );
465+
466+ fsc -> debugfs_metrics_dir = debugfs_create_dir ("metrics" ,
467+ fsc -> client -> debugfs_dir );
468+
469+ debugfs_create_file ("file" , 0400 , fsc -> debugfs_metrics_dir , fsc ,
470+ & metrics_file_fops );
471+ debugfs_create_file ("latency" , 0400 , fsc -> debugfs_metrics_dir , fsc ,
472+ & metrics_latency_fops );
473+ debugfs_create_file ("size" , 0400 , fsc -> debugfs_metrics_dir , fsc ,
474+ & metrics_size_fops );
475+ debugfs_create_file ("caps" , 0400 , fsc -> debugfs_metrics_dir , fsc ,
476+ & metrics_caps_fops );
446477}
447478
448479
0 commit comments