Re: [PATCH v3 v3 1/2] ext4: add blocks_allocated to mb_stats output

From: Baokun Li

Date: Thu Apr 23 2026 - 22:35:32 EST




On 2026/4/22 09:50, Baolin Liu wrote:
> From: Baolin Liu <liubaolin@xxxxxxxxxx>
>
> Add blocks_allocated to /proc/fs/ext4/<dev>/mb_stats so that the
> reported statistics match the mballoc summary printed at unmount time.
>
> Reviewed-by: Ojaswin Mujoo <ojaswin@xxxxxxxxxxxxx>
> Reviewed-by: Andreas Dilger <adilger@xxxxxxxxx>
> Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@xxxxxxxxx>
> Reviewed-by: Zhang Yi <yi.zhang@xxxxxxxxxx>
> Signed-off-by: Baolin Liu <liubaolin@xxxxxxxxxx>

Looks good, feel free to add:

Reviewed-by: Baokun Li <libaokun@xxxxxxxxxxxxxxxxx>

> ---
> fs/ext4/mballoc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 20e9fdaf4301..1e13ef62cb9d 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -3211,6 +3211,8 @@ int ext4_seq_mb_stats_show(struct seq_file *seq, void *offset)
> "\tTo enable, please write \"1\" to sysfs file mb_stats.\n");
> return 0;
> }
> + seq_printf(seq, "\tblocks_allocated: %u\n",
> + atomic_read(&sbi->s_bal_allocated));
> seq_printf(seq, "\treqs: %u\n", atomic_read(&sbi->s_bal_reqs));
> seq_printf(seq, "\tsuccess: %u\n", atomic_read(&sbi->s_bal_success));
>