From: Daan De Meyer Date: Wed, 13 Mar 2024 16:18:16 +0000 (+0100) Subject: Optimize is_subvolume() X-Git-Tag: v22~6^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f9c4c8fd9711b77b6234f63852a9bdd5fb81feb;p=thirdparty%2Fmkosi.git Optimize is_subvolume() Try the condition that doesn't need a subprocess to run first. --- diff --git a/mkosi/tree.py b/mkosi/tree.py index 0673421a6..6399921e4 100644 --- a/mkosi/tree.py +++ b/mkosi/tree.py @@ -23,7 +23,7 @@ def statfs(path: Path, *, sandbox: SandboxProtocol = nosandbox) -> str: def is_subvolume(path: Path, *, sandbox: SandboxProtocol = nosandbox) -> bool: - return path.is_dir() and statfs(path, sandbox=sandbox) == "btrfs" and path.stat().st_ino == 256 + return path.is_dir() and path.stat().st_ino == 256 and statfs(path, sandbox=sandbox) == "btrfs" def cp_version(*, sandbox: SandboxProtocol = nosandbox) -> GenericVersion: