Re: [PATCH v2 04/12] ext4: Convert mballoc cr (criteria) to enum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
> Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@xxxxxxxxx>

...

> 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@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux