commit:     7f56464980872415d7242e301c9e5b9c322bf292
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 21 09:54:12 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec 21 09:56:06 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=7f564649

Drop --jobs-tmpdir-require-free-kilo-inodes

Let's see if there's a real need for it based on user reports. Having
to maintain a whitelist/blacklist of FSes where f_favail is meaningful
isn't something I want to maintain. If issues arise, let's first
start with an ENOSPC check.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/_emerge/Scheduler.py              | 39 +++--------------------------------
 lib/_emerge/main.py                   | 21 -------------------
 lib/portage/util/path.py              | 39 +----------------------------------
 lib/portage/util/portage_lru_cache.py |  1 -
 4 files changed, 4 insertions(+), 96 deletions(-)

diff --git a/lib/_emerge/Scheduler.py b/lib/_emerge/Scheduler.py
index 41c75db9de..9e4128704b 100644
--- a/lib/_emerge/Scheduler.py
+++ b/lib/_emerge/Scheduler.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 from collections import deque
@@ -27,7 +27,7 @@ from portage._sets import SETPREFIX
 from portage._sets.base import InternalPackageSet
 from portage.util import ensure_dirs, writemsg, writemsg_level
 from portage.util.futures import asyncio
-from portage.util.path import first_existing, get_fs_type_cached
+from portage.util.path import first_existing
 from portage.util.SlotObject import SlotObject
 from portage.util._async.SchedulerInterface import SchedulerInterface
 from portage.package.ebuild.digestcheck import digestcheck
@@ -237,13 +237,6 @@ class Scheduler(PollScheduler):
             # dev-lang/rust-1.77.1: ~16 GiB
             # www-client/chromium-126.0.6478.57: ~18 GiB
             self._jobs_tmpdir_require_free_gb = 18
-        self._jobs_tmpdir_require_free_kilo_inodes = myopts.get(
-            "--jobs-tmpdir-require-free-kilo-inodes"
-        )
-        if not self._jobs_tmpdir_require_free_kilo_inodes:
-            # dev-lang/rust-1.77.1: ~ 450k inodes
-            # www-client/chromium-126.0.6478.57: ~1011K
-            self._jobs_tmpdir_require_free_kilo_inodes = 1100
         self.edebug = 0
         if settings.get("PORTAGE_DEBUG", "") == "1":
             self.edebug = 1
@@ -1829,7 +1822,6 @@ class Scheduler(PollScheduler):
         return self._jobs
 
     _warned_tmpdir_free_space = False
-    _warned_tmpdir_free_inodes = False
 
     def _can_add_job(self):
         if not super()._can_add_job():
@@ -1841,10 +1833,7 @@ class Scheduler(PollScheduler):
             # jobs and no jobs in the _merge_wait_queue.
             return True
 
-        if (
-            self._jobs_tmpdir_require_free_gb is not None
-            or self._jobs_tmpdir_require_free_kilo_inodes is not None
-        ) and hasattr(os, "statvfs"):
+        if (self._jobs_tmpdir_require_free_gb is not None) and hasattr(os, 
"statvfs"):
             tmpdirs = set()
             for root in self.trees:
                 settings = self.trees[root]["root_config"].settings
@@ -1896,28 +1885,6 @@ class Scheduler(PollScheduler):
                                 self._warned_tmpdir_free_space = True
                             return False
 
-                    if (
-                        self._jobs_tmpdir_require_free_kilo_inodes
-                        and self._jobs_tmpdir_require_free_kilo_inodes != 0
-                        # Only check free inode count on filesystems with a 
static inode count
-                        and get_fs_type_cached(tmpdir) in ("ext4", "ext3", 
"ext2")
-                    ):
-                        required_free_inodes = (
-                            self._jobs_tmpdir_require_free_kilo_inodes * 1000
-                        )
-                        required_free_inodes = 
scale_to_jobs(required_free_inodes)
-
-                        if vfs_stat.f_favail < required_free_inodes:
-                            if not self._warned_tmpdir_free_inodes:
-                                msg = f"--- {tmpdir} has not enough free 
inodes, emerge job parallelism reduced. free: {vfs_stat.f_favail} inodes, 
required: {required_free_inodes} inodes"
-                                portage.writemsg_stdout(
-                                    colorize("WARN", f"\n{msg}\n"), 
noiselevel=-1
-                                )
-                                self._logger.log(msg)
-
-                                self._warned_tmpdir_free_inodes = True
-                            return False
-
         return True
 
     def _schedule_tasks(self):

diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py
index 12cfdd1378..55a7bcb690 100644
--- a/lib/_emerge/main.py
+++ b/lib/_emerge/main.py
@@ -155,7 +155,6 @@ def insert_optional_args(args):
         "--ignore-world": y_or_n,
         "--jobs": valid_integers,
         "--jobs-tmpdir-require-free-gb": valid_integers,
-        "--jobs-tmpdir-require-free-kilo-inodes": valid_integers,
         "--keep-going": y_or_n,
         "--load-average": valid_floats,
         "--onlydeps-with-ideps": y_or_n,
@@ -520,10 +519,6 @@ def parse_opts(tmpcmdline, silent=False):
             "help": "Specifies the required remaining capacity (in GiB) of 
PORTAGE_TMPDIR before a new emerge job is started. Set to 0 to disable this 
check",
             "action": "store",
         },
-        "--jobs-tmpdir-require-free-kilo-inodes": {
-            "help": "Specifies the required remaining inodes (in thousands) of 
PORTAGE_TMPDIR before a new emerge job is started. Set to 0 to disable this 
check",
-            "action": "store",
-        },
         "--keep-going": {
             "help": "continue as much as possible after an error",
             "choices": true_y_or_n,
@@ -1048,22 +1043,6 @@ def parse_opts(tmpcmdline, silent=False):
 
         myoptions.jobs_tmpdir_require_free_gb = jobs_tmpdir_require_free_gb
 
-    if myoptions.jobs_tmpdir_require_free_kilo_inodes:
-        try:
-            jobs_tmpdir_require_free_kilo_inodes = int(
-                myoptions.jobs_tmpdir_require_free_kilo_indoes
-            )
-        except ValueError:
-            jobs_tmpdir_require_free_kilo_inodes = 0
-            if not silent:
-                parser.error(
-                    f"Invalid --jobs-tmpdir-require-free-kilo-inodes 
parameter: '{myoptions.jobs_tmpdir_require_free_kilo_indoes}'\n"
-                )
-
-        myoptions.jobs_tmpdir_require_free_kilo_inodes = (
-            jobs_tmpdir_require_free_kilo_inodes
-        )
-
     if myoptions.load_average == "True":
         myoptions.load_average = None
 

diff --git a/lib/portage/util/path.py b/lib/portage/util/path.py
index 6191cfe49d..c906878a87 100644
--- a/lib/portage/util/path.py
+++ b/lib/portage/util/path.py
@@ -1,12 +1,8 @@
-# Copyright 2014-2025 Gentoo Authors
+# Copyright 2014-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 import errno
-import os
-import platform
 
-from functools import lru_cache
-from typing import Optional
 from portage import os
 
 
@@ -54,36 +50,3 @@ def iter_parents(path):
         if not path:
             break
         yield path
-
-
-@lru_cache(32)
-def get_fs_type_cached(path: str) -> Optional[str]:
-    return get_fs_type(path)
-
-
-def get_fs_type(path: str) -> Optional[str]:
-    if platform.system() == "Linux":
-        return get_fs_type_linux(path)
-
-    return None
-
-
-def get_fs_type_linux(path: str) -> Optional[str]:
-    real_path = os.path.realpath(path)
-    best_match_len = -1
-    fs_type = None
-
-    with open("/proc/mounts") as f:
-        for line in f:
-            parts = line.split()
-            mount_point = parts[1]
-
-            if not real_path.startswith(mount_point):
-                continue
-
-            mount_point_len = len(mount_point)
-            if mount_point_len > best_match_len:
-                best_match_len = mount_point_len
-                fs_type = parts[2]
-
-    return fs_type

diff --git a/lib/portage/util/portage_lru_cache.py 
b/lib/portage/util/portage_lru_cache.py
index 000b4c1fee..6cf689ef23 100644
--- a/lib/portage/util/portage_lru_cache.py
+++ b/lib/portage/util/portage_lru_cache.py
@@ -15,7 +15,6 @@ def show_lru_cache_info():
         portage.process._encoded_length: "encoded_length",
         portage.versions.catpkgsplit: "catpkgsplit",
         portage.versions.vercmp: "vercmp",
-        portage.util.path.get_fs_type_cached: "get_fs_type_cached",
     }
 
     print("Portage @lru_cache information")

Reply via email to