From 7b13d4a0d6c0b180e6ecae5a0f92c6f01344c712 Mon Sep 17 00:00:00 2001 From: Koi to Coco Date: Sun, 2 Jun 2024 08:29:07 +0000 Subject: [PATCH] display btrfs subvolume as one partition, issue #375 --- src/linux/btop_collect.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp index d9f571f1..631cb198 100644 --- a/src/linux/btop_collect.cpp +++ b/src/linux/btop_collect.cpp @@ -1837,6 +1837,21 @@ namespace Mem { size_t zfs_dataset_name_start = 0; if (fstype == "zfs" && (zfs_dataset_name_start = dev.find('/')) != std::string::npos && zfs_hide_datasets) continue; + //? skip BtrFS subvolumes + if (fstype == "btrfs") { + bool other_subvol_found = false; + string devname = fs::canonical(dev, ec).filename(); + for (auto& [mp, info] : disks) { + if (info.dev.filename() == devname and mp != mountpoint) { + other_subvol_found = true; + break; + } + } + if (other_subvol_found) { + continue; + } + } + if ((not use_fstab and not only_physical) or (use_fstab and v_contains(fstab, mountpoint)) or (not use_fstab and only_physical and v_contains(fstypes, fstype))) {