After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 708107 - Usage of swap space is not reported
Usage of swap space is not reported
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
GIT HEAD
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2013-09-15 11:56 UTC by Mike Fleetwood
Modified: 2013-12-09 18:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Report linux-swap usage, etc. (v1) (7.19 KB, patch)
2013-09-15 13:25 UTC, Mike Fleetwood
none Details | Review

Description Mike Fleetwood 2013-09-15 11:56:46 UTC
Patch to follow shortly.
Comment 1 Mike Fleetwood 2013-09-15 13:25:47 UTC
Created attachment 254968 [details] [review]
Report linux-swap usage, etc. (v1)

Hi Curtis,

Here's the fix with a couple of other small ones too.  Obviously this
is for after the 0.16.2 release.

    Add reporting of linux-swap usage (#708107)
    Actually display error message from statvfs() failure
    Allow GParted to read the UUID from older btrfs-show command

Thanks,
Mike
Comment 2 Curtis Gedak 2013-09-24 16:57:13 UTC
Hi Mike,

This patch set looks good to me.  While I did not expect any problems with the patch set, I thought it best to retest GParted with this patch on some currently supported GNU/Linux distributions.  I successfully compiled and ran the patched code on the following distros:

  debian 6
  fedora 19
  kubuntu 12.04 LTS
  openSUSE 12.2


Regarding swap usage I noticed situations where commands like "top" and "cat /proc/swaps" would indicate 0 kB used, whereas this patch would show 4 KiB  or 8 KiB used.  I believe this comes from the difference between the partition size, and the actual amount of available swap space for processes.  Hence the 4 KiB or 8 KiB used is most likely space taken up for metadata in the linux-swap file system.

We might get a few questions on this by users.


The patch set in comment #1 has been committed to the git repository for inclusion in the next release of GParted.

The relevant commits can be viewed at the following links:

Add reporting of linux-swap usage (#708107)
https://git.gnome.org/browse/gparted/commit/?id=387b391d6dd2b8d02807a20800fff78da673fd60

Actually display error message from statvfs() failure
https://git.gnome.org/browse/gparted/commit/?id=293c8929a7a703f68f1901518a74371a91db6ae2

Allow GParted to read the UUID from older btrfs-show command
https://git.gnome.org/browse/gparted/commit/?id=21aa90b847bf63a60e957600978174c29a7aaa44
Comment 3 Mike Fleetwood 2013-09-25 08:20:07 UTC
Hi Curtis,

Yes that's correct the 4 or 8 KiB used comes from GParted different view
which is:
    partition size - free space = used space

So format overhead gets counted as used space.

    # sfdisk -s /dev/sda10
    1048576
    # mkswap /dev/sda10
    Setting up swapspace version 1, size = 1048572 KiB
    no label, UUID=0dfc5316-e460-44ca-b8bf-e79b4660aa17
    # swapon /dev/sda10
    # grep sda10 /proc/swaps 
    /dev/sda10                              partition	1048572	0	-2

PTN size is           1048576 KiB
Swap space is         1048572 KiB
Swap format overhead        4 KiB

If reporting of this overhead becomes a problem it could disappear (at
the cost of never getting swap more than 99.99% full) by using the
partition size, rather that the size of the swap space as the first
parameter, sectors_fs_size, to set_sector_usage().  However this would
be different to how GParted calculates every other file system type.

Thanks,
Mike
Comment 4 Curtis Gedak 2013-12-09 18:06:18 UTC
This enhancement was included in the GParted 0.17.0 release on December 9, 2013.