diff options
author | Ondrej Holy <oholy@redhat.com> | 2017-02-24 14:26:44 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2017-04-29 14:20:19 +0200 |
commit | b619f7c96a0c26dd3cb303ca731d4b7adaac8d99 (patch) | |
tree | 16d21f1e064ad98b8dc62e8d1e480156c5cd7def /panels | |
parent | 87928a5d6fae375e1b14e7e81612e7ee56b0f455 (diff) | |
download | gnome-control-center-b619f7c96a0c26dd3cb303ca731d4b7adaac8d99.tar.gz |
info: Fix total disc size for btrfs subvolumes
Total disc size may be wrong if something like btrfs subvolumes are
used. Do not count multiple mounts with same device_path, because
it is probably something like btrfs subvolume. Use only the first one
in order to count the real size.
https://bugzilla.gnome.org/show_bug.cgi?id=708786
Diffstat (limited to 'panels')
-rw-r--r-- | panels/info/cc-info-overview-panel.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/panels/info/cc-info-overview-panel.c b/panels/info/cc-info-overview-panel.c index 6f7d15c8c..45ad54887 100644 --- a/panels/info/cc-info-overview-panel.c +++ b/panels/info/cc-info-overview-panel.c @@ -556,8 +556,10 @@ get_primary_disc_info (CcInfoOverviewPanel *self) { GList *points; GList *p; + GHashTable *hash; CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self); + hash = g_hash_table_new (g_str_hash, g_str_equal); points = g_unix_mount_points_get (NULL); /* If we do not have /etc/fstab around, try /etc/mtab */ @@ -568,21 +570,29 @@ get_primary_disc_info (CcInfoOverviewPanel *self) { GUnixMountEntry *mount = p->data; const char *mount_path; + const char *device_path; mount_path = g_unix_mount_get_mount_path (mount); + device_path = g_unix_mount_get_device_path (mount); + /* Do not count multiple mounts with same device_path, because it is + * probably something like btrfs subvolume. Use only the first one in + * order to count the real size. */ if (gsd_should_ignore_unix_mount (mount) || gsd_is_removable_mount (mount) || g_str_has_prefix (mount_path, "/media/") || - g_str_has_prefix (mount_path, g_get_home_dir ())) + g_str_has_prefix (mount_path, g_get_home_dir ()) || + g_hash_table_lookup (hash, device_path) != NULL) { g_unix_mount_free (mount); continue; } priv->primary_mounts = g_list_prepend (priv->primary_mounts, mount); + g_hash_table_insert (hash, (gpointer) device_path, (gpointer) device_path); } g_list_free (points); + g_hash_table_destroy (hash); get_primary_disc_info_start (self); } |