ZFS: Changes.

edi-0.5
Alastair Poole 4 years ago
parent f5e8d5e6de
commit b8e8164f85
  1. 24
      src/bin/system/disks.c
  2. 5
      src/bin/system/disks.h
  3. 25
      src/bin/system/filesystems.c
  4. 5
      src/bin/system/filesystems.h
  5. 3
      src/bin/ui/ui.c
  6. 7
      src/bin/ui/ui_disk.c

@ -87,30 +87,6 @@ _cmp_cb(const void *p1, const void *p2)
return strcmp(s1, s2);
}
Eina_Bool
disk_zfs_mounted_get(void)
{
Eina_List *disks;
char *path;
Eina_Bool zfs_mounted = EINA_FALSE;
disks = disks_get();
EINA_LIST_FREE(disks, path)
{
Filesystem_Info *fs = filesystem_info_get(path);
if (fs)
{
if (fs->type == filesystem_id_by_name("ZFS"))
zfs_mounted = EINA_TRUE;
filesystem_info_free(fs);
}
free(path);
}
return zfs_mounted;
}
Eina_List *
disks_get(void)
{

@ -2,11 +2,6 @@
#define __DISKS_H__
#include "filesystems.h"
#include <Eina.h>
#include <Ecore.h>
Eina_Bool
disk_zfs_mounted_get(void);
char *
disk_mount_point_get(const char *path);

@ -158,3 +158,28 @@ filesystem_info_free(Filesystem_Info *fs)
free(fs);
}
Eina_Bool
filesystem_in_use(const char *name)
{
Eina_List *disks;
char *path;
Eina_Bool fs_mounted = EINA_FALSE;
if (!name) return EINA_FALSE;
disks = disks_get();
EINA_LIST_FREE(disks, path)
{
Filesystem_Info *fs = filesystem_info_get(path);
if (fs)
{
if (fs->type == filesystem_id_by_name(name))
fs_mounted = EINA_TRUE;
filesystem_info_free(fs);
}
free(path);
}
return fs_mounted;
}

@ -1,6 +1,8 @@
#ifndef __FILESYSTEMS_H__
#define __FILESYSTEMS_H__
#include <Eina.h>
typedef struct {
unsigned long long total;
unsigned long long used;
@ -25,4 +27,7 @@ filesystem_info_get(const char *path);
void
filesystem_info_free(Filesystem_Info *fs);
Eina_Bool
filesystem_in_use(const char *name);
#endif

@ -1684,7 +1684,8 @@ _ui_init(Evas_Object *parent)
ui->cpu_times = NULL;
ui->cpu_list = NULL;
ui->zfs_mounted = disk_zfs_mounted_get();
// Only take account of the ZFS ARC if there is an active mount.
ui->zfs_mounted = filesystem_in_use("ZFS");
_ui = NULL;
_evisum_config = NULL;

@ -96,6 +96,7 @@ ui_tab_disk_update(Ui *ui)
if (!ui->disk_visible)
return;
// FIXME
elm_box_clear(ui->disk_activity);
disks = disks_get();
@ -104,6 +105,9 @@ ui_tab_disk_update(Ui *ui)
Filesystem_Info *fs = filesystem_info_get(path);
if (fs)
{
// ZFS usage may have changed during application's lifetime.
// Keep track of ZFS mounts else we may report bogus use
// of memory.
if (fs->type == filesystem_id_by_name("ZFS"))
zfs_mounted = EINA_TRUE;
@ -115,6 +119,9 @@ ui_tab_disk_update(Ui *ui)
if (disks)
eina_list_free(disks);
// Need to keep track of ZFS mounts. If we have no mounts
// then memory usage should not take into account the ZFS
// ARC memory allocation.
if (!zfs_mounted) ui->zfs_mounted = EINA_FALSE;
}

Loading…
Cancel
Save