@@ -204,6 +204,7 @@ read_attribute(disk_groups);
204204read_attribute (has_data );
205205read_attribute (alloc_debug );
206206read_attribute (accounting );
207+ read_attribute (usage_base );
207208
208209#define x (t , n , ...) read_attribute(t);
209210BCH_PERSISTENT_COUNTERS ()
@@ -303,6 +304,20 @@ static void bch2_gc_gens_pos_to_text(struct printbuf *out, struct bch_fs *c)
303304 prt_printf (out , "\n" );
304305}
305306
307+ static void bch2_fs_usage_base_to_text (struct printbuf * out , struct bch_fs * c )
308+ {
309+ struct bch_fs_usage_base b = {};
310+
311+ acc_u64s_percpu (& b .hidden , & c -> usage -> hidden , sizeof (b ) / sizeof (u64 ));
312+
313+ prt_printf (out , "hidden:\t\t%llu\n" , b .hidden );
314+ prt_printf (out , "btree:\t\t%llu\n" , b .btree );
315+ prt_printf (out , "data:\t\t%llu\n" , b .data );
316+ prt_printf (out , "cached:\t%llu\n" , b .cached );
317+ prt_printf (out , "reserved:\t\t%llu\n" , b .reserved );
318+ prt_printf (out , "nr_inodes:\t%llu\n" , b .nr_inodes );
319+ }
320+
306321SHOW (bch2_fs )
307322{
308323 struct bch_fs * c = container_of (kobj , struct bch_fs , kobj );
@@ -392,6 +407,9 @@ SHOW(bch2_fs)
392407 if (attr == & sysfs_accounting )
393408 bch2_fs_accounting_to_text (out , c );
394409
410+ if (attr == & sysfs_usage_base )
411+ bch2_fs_usage_base_to_text (out , c );
412+
395413 return 0 ;
396414}
397415
@@ -606,6 +624,7 @@ struct attribute *bch2_fs_internal_files[] = {
606624 & sysfs_disk_groups ,
607625 & sysfs_alloc_debug ,
608626 & sysfs_accounting ,
627+ & sysfs_usage_base ,
609628 NULL
610629};
611630
0 commit comments