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