Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit f22b0c1c authored by Christian Oder's avatar Christian Oder Committed by Michael Bestas
Browse files

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
parent 3486685e
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -278,7 +278,7 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config):
      base_fs_file = ConvertBlockMapToBaseFs(prop_dict["base_fs_file"])
      build_command.extend(["-d", base_fs_file])
    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"]])
    if "extfs_rsv_pct" in prop_dict:
      build_command.extend(["-M", prop_dict["extfs_rsv_pct"]])
@@ -504,6 +504,7 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
          size = common.RoundUpTo4K(size)
        else:
          size = ((size + block_size - 1) // block_size) * block_size
      if int(prop_dict["extfs_inode_count"]) >= 0:
        extfs_inode_count = prop_dict["extfs_inode_count"]
        inodes = int(fs_dict.get("Inode count", extfs_inode_count))
        inodes -= int(fs_dict.get("Free inodes", "0"))
@@ -514,9 +515,9 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
          spare_inodes = min_spare_inodes
        inodes += spare_inodes
        prop_dict["extfs_inode_count"] = str(inodes)
      prop_dict["partition_size"] = str(size)
        logger.info(
            "Allocating %d Inodes for %s.", inodes, out_file)
      prop_dict["partition_size"] = str(size)
    elif fs_type.startswith("f2fs") and prop_dict.get("f2fs_compress") == "true":
      prop_dict["partition_size"] = str(size)
      prop_dict["image_size"] = str(size)