]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Optimize is_subvolume()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 13 Mar 2024 16:18:16 +0000 (17:18 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 13 Mar 2024 16:21:29 +0000 (17:21 +0100)
Try the condition that doesn't need a subprocess to run first.

mkosi/tree.py

index 0673421a6c98e896d903460ecb86b39644f96427..6399921e42bc05d5b5b3cc4a4c84d4f5af80f6d6 100644 (file)
@@ -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: