[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 6 Jun 2023 15:13:55 +0200
From: Jan Kara <jack@...e.cz>
To: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
Cc: linux-ext4@...r.kernel.org, Theodore Ts'o <tytso@....edu>,
Ritesh Harjani <riteshh@...ux.ibm.com>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Jan Kara <jack@...e.cz>,
Kemeng Shi <shikemeng@...weicloud.com>,
Ritesh Harjani <ritesh.list@...il.com>
Subject: Re: [PATCH v2 04/12] ext4: Convert mballoc cr (criteria) to enum
On Tue 30-05-23 18:03:42, Ojaswin Mujoo wrote:
> Convert criteria to be an enum so it easier to maintain and
> update the tracefiles to use enum names. This change also makes
> it easier to insert new criterias in the future.
>
> There is no functional change in this patch.
>
> Signed-off-by: Ojaswin Mujoo <ojaswin@...ux.ibm.com>
> Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@...il.com>
...
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index c075da665ec1..f9a4eaa10c6a 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -127,6 +127,23 @@ enum SHIFT_DIRECTION {
> SHIFT_RIGHT,
> };
>
> +/*
> + * Number of criterias defined. For each criteria, mballoc has slightly
> + * different way of finding the required blocks nad usually, higher the
> + * criteria the slower the allocation. We start at lower criterias and keep
> + * falling back to higher ones if we are not able to find any blocks.
> + */
> +#define EXT4_MB_NUM_CRS 4
> +/*
> + * All possible allocation criterias for mballoc
> + */
> +enum criteria {
> + CR0,
> + CR1,
> + CR2,
> + CR3,
> +};
Usually we define EXT4_MB_NUM_CRS like:
enum criteria {
CR0,
CR1,
CR2,
CR3,
EXT4_MB_NUM_CRS
};
> @@ -2626,7 +2626,7 @@ static noinline_for_stack int
> ext4_mb_regular_allocator(struct ext4_allocation_context *ac)
> {
> ext4_group_t prefetch_grp = 0, ngroups, group, i;
> - int cr = -1, new_cr;
> + enum criteria cr, new_cr;
> int err = 0, first_err = 0;
> unsigned int nr = 0, prefetch_ios = 0;
> struct ext4_sb_info *sbi;
This can cause uninitialized use of 'cr' variable in the 'out:' label.
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists