Re: [PATCH 7/7] ext4: improve inode table blocks counting in ext4_num_overhead_clusters

From: Jan Kara
Date: Mon Mar 20 2023 - 08:45:31 EST


On Tue 21-02-23 19:59:19, Kemeng Shi wrote:
> As inode table blocks are contiguous, inode table blocks inside the
> block_group can be represented as range [itbl_cluster_start,
> itbl_cluster_last]. Then we can simply account inode table cluters and
> check cluster overlap with [itbl_cluster_start, itbl_cluster_last] instead
> of traverse each block of inode table.
> By the way, this patch fixes code style problem of comment for
> ext4_num_overhead_clusters.
>
> Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>

FWIW this is triggering Coverity warning:

*** CID 1536792: Uninitialized variables (UNINIT)
/fs/ext4/balloc.c: 153 in ext4_num_overhead_clusters()
147 inode_cluster = EXT4_B2C(sbi,
148 ext4_inode_bitmap(sb, gdp) - st
149 /*
150 * Additional check if inode bitmap is in just accounted
151 * block_cluster
152 */
>>> CID 1536792: Uninitialized variables (UNINIT)
>>> Using uninitialized value "block_cluster".
153 if (inode_cluster != block_cluster &&
154 inode_cluster >= base_clusters &&
155 (inode_cluster < itbl_cluster_start ||
156 inode_cluster > itbl_cluster_end))
157 num_clusters++;
158 }

which actually looks valid AFAICT.

Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR