ext4: improve inode table blocks counting in ext4_num_overhead_clusters
authorKemeng Shi <shikemeng@huaweicloud.com>
Tue, 21 Feb 2023 11:59:19 +0000 (19:59 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 24 Mar 2023 03:00:08 +0000 (23:00 -0400)
commit68e294dcccf965c93d65c4660547794728a4cff0
tree90cf8f8edf8da4ab8a034f41acff93c35e7626a0
parentcefa74d004fa48bc073ad66b7a7ad00dc8d7bfa6
ext4: improve inode table blocks counting in ext4_num_overhead_clusters

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.

[ Merged fix-up patch which fixed potentially access to an
  uninitialzied stack variable. --TYT ]

Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
Link: https://lore.kernel.org/r/20230221115919.1918161-8-shikemeng@huaweicloud.com
Link: https://lore.kernel.org/r/202303171446.eLEhZzAu-lkp@intel.com/
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/balloc.c