build_image: Allow disabling custom inode count calculation
This allows us to skip custom inode count calculation by setting BOARD_*IMAGE_EXTFS_INODE_COUNT to -1, this will end up letting mke2fs calculate appropriate inode count on its own. While build_image only allocates exact number of needed inodes plus 4% spare with .2% margin, mke2fs will allocate as many inodes as it thinks is appropriate given the filesystem size. Change-Id: If03d5edae8378be3b305346176067b01163f6f3d
This commit is contained in:
parent
30f779c15b
commit
d76725c913
1 changed files with 14 additions and 13 deletions
|
@ -312,7 +312,7 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config):
|
||||||
base_fs_file = ConvertBlockMapToBaseFs(prop_dict["base_fs_file"])
|
base_fs_file = ConvertBlockMapToBaseFs(prop_dict["base_fs_file"])
|
||||||
build_command.extend(["-d", base_fs_file])
|
build_command.extend(["-d", base_fs_file])
|
||||||
build_command.extend(["-L", prop_dict["mount_point"]])
|
build_command.extend(["-L", prop_dict["mount_point"]])
|
||||||
if "extfs_inode_count" in prop_dict:
|
if "extfs_inode_count" in prop_dict and int(prop_dict["extfs_inode_count"]) >= 0:
|
||||||
build_command.extend(["-i", prop_dict["extfs_inode_count"]])
|
build_command.extend(["-i", prop_dict["extfs_inode_count"]])
|
||||||
if "extfs_rsv_pct" in prop_dict:
|
if "extfs_rsv_pct" in prop_dict:
|
||||||
build_command.extend(["-M", prop_dict["extfs_rsv_pct"]])
|
build_command.extend(["-M", prop_dict["extfs_rsv_pct"]])
|
||||||
|
@ -606,19 +606,20 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
|
||||||
size = common.RoundUpTo4K(size)
|
size = common.RoundUpTo4K(size)
|
||||||
else:
|
else:
|
||||||
size = ((size + block_size - 1) // block_size) * block_size
|
size = ((size + block_size - 1) // block_size) * block_size
|
||||||
extfs_inode_count = prop_dict["extfs_inode_count"]
|
if int(prop_dict["extfs_inode_count"]) >= 0:
|
||||||
inodes = int(fs_dict.get("Inode count", extfs_inode_count))
|
extfs_inode_count = prop_dict["extfs_inode_count"]
|
||||||
inodes -= int(fs_dict.get("Free inodes", "0"))
|
inodes = int(fs_dict.get("Inode count", extfs_inode_count))
|
||||||
# add .2% margin or 1 inode, whichever is greater
|
inodes -= int(fs_dict.get("Free inodes", "0"))
|
||||||
spare_inodes = inodes * 2 // 1000
|
# add .2% margin or 1 inode, whichever is greater
|
||||||
min_spare_inodes = 1
|
spare_inodes = inodes * 2 // 1000
|
||||||
if spare_inodes < min_spare_inodes:
|
min_spare_inodes = 1
|
||||||
spare_inodes = min_spare_inodes
|
if spare_inodes < min_spare_inodes:
|
||||||
inodes += spare_inodes
|
spare_inodes = min_spare_inodes
|
||||||
prop_dict["extfs_inode_count"] = str(inodes)
|
inodes += spare_inodes
|
||||||
|
prop_dict["extfs_inode_count"] = str(inodes)
|
||||||
|
logger.info(
|
||||||
|
"Allocating %d Inodes for %s.", inodes, out_file)
|
||||||
prop_dict["partition_size"] = str(size)
|
prop_dict["partition_size"] = str(size)
|
||||||
logger.info(
|
|
||||||
"Allocating %d Inodes for %s.", inodes, out_file)
|
|
||||||
elif fs_type.startswith("f2fs") and prop_dict.get("f2fs_compress") == "true":
|
elif fs_type.startswith("f2fs") and prop_dict.get("f2fs_compress") == "true":
|
||||||
prop_dict["partition_size"] = str(size)
|
prop_dict["partition_size"] = str(size)
|
||||||
prop_dict["image_size"] = str(size)
|
prop_dict["image_size"] = str(size)
|
||||||
|
|
Loading…
Reference in a new issue