Freespacenotifier KDED module in kdereview

Ivo Anjo knuckles at gmail.com
Mon May 17 23:28:57 BST 2010


I do think this is cached by the kernel. I've done a quick test that loops
while doing stat and displaying the free space every second, something like:

#include <sys/vfs.h>
#include <stdio.h>

int main() {
    struct statfs sfs;
    while ( statfs( "/home/", &sfs ) == 0 ) {
        long avail = ((long long)( getuid() ? sfs.f_bavail : sfs.f_bfree ) *
sfs.f_bsize / ( 1024 * 1024 ));
        printf("avail is: %ld mb\n", avail);
        sleep(1);
    }
    return 0;
}

and if I put my disk to sleep with hdparm -y /dev/sda the program runs for
some seconds doing the polling and the hdd doesn't wake up, but I'm guessing
that eventually something else wakes it up (I'm on a desktop system).

But I really don't have a better solution to present. I do think monitoring
the space is important as very bad things happen (tm) when you run out of
space in /home, and currently the use has no way of getting notified of it.

Ivo

On Mon, May 17, 2010 at 4:13 PM, Sebastian Kügler <sebas at kde.org> wrote:

> On Monday 17 May 2010 16:57:29 Jacopo De Simoi wrote:
> > I've a question about this module, as far as I can understand it polls
>  the
> > disk on which $HOME is mounted every minute to check the available disk
> > space.  This is something we carefully avoided to do in the plasma device
> > notifier because by doing so we keep the disks awake instead of letting
> > them sleep if unused if the user desires so. This module would probably
> > upset laptop users, am I right? (ervin?)
>
> Yes, definitely. This kind of stuff totally destroys power management for
> disks.
> In general, the idea of polling for this kind of thing is just broken
> (though I
> wouldn't know another way of doing the free space thing). Just to give you
> an
> idea, polling the disk every minute (and thereby preventing its sleep) can
> easily
> cost you about 10% of that precious battery life, just by keeping the disk
> spinning.
>
> Maybe disk quotas are what we're really looking for?
>
> > I would personally  like to have the service disabled at the very least
> if
> > running on batteries (you can get an idea of how to do it by looking at
> > how it's done for the strigi indexer), and  to check available space less
> > often than every minute in the general case.
> --
> sebas
>
> http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100517/4168abc4/attachment.htm>


More information about the kde-core-devel mailing list