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:<br><br>#include <sys/vfs.h><br>#include <stdio.h><br><br>
int main() {<br>    struct statfs sfs;<br>    while ( statfs( "/home/", &sfs ) == 0 ) {<br>        long avail = ((long long)( getuid() ? sfs.f_bavail : sfs.f_bfree ) * sfs.f_bsize / ( 1024 * 1024 ));<br>        printf("avail is: %ld mb\n", avail);<br>
        sleep(1);<br>    }<br>    return 0;<br>}<br><br>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).<br>
<br>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.<br>
<br>Ivo<br><br><div class="gmail_quote">On Mon, May 17, 2010 at 4:13 PM, Sebastian Kügler <span dir="ltr"><<a href="mailto:sebas@kde.org" target="_blank">sebas@kde.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>On Monday 17 May 2010 16:57:29 Jacopo De Simoi wrote:<br>
> I've a question about this module, as far as I can understand it polls  the<br>
> disk on which $HOME is mounted every minute to check the available disk<br>
> space.  This is something we carefully avoided to do in the plasma device<br>
> notifier because by doing so we keep the disks awake instead of letting<br>
> them sleep if unused if the user desires so. This module would probably<br>
> upset laptop users, am I right? (ervin?)<br>
<br>
</div>Yes, definitely. This kind of stuff totally destroys power management for disks.<br>
In general, the idea of polling for this kind of thing is just broken (though I<br>
wouldn't know another way of doing the free space thing). Just to give you an<br>
idea, polling the disk every minute (and thereby preventing its sleep) can easily<br>
cost you about 10% of that precious battery life, just by keeping the disk<br>
spinning.<br>
<br>
Maybe disk quotas are what we're really looking for?<br>
<div><div></div><div><br>
> I would personally  like to have the service disabled at the very least if<br>
> running on batteries (you can get an idea of how to do it by looking at<br>
> how it's done for the strigi indexer), and  to check available space less<br>
> often than every minute in the general case.<br>
</div></div><font color="#888888">--<br>
sebas<br>
<br>
<a href="http://www.kde.org" target="_blank">http://www.kde.org</a> | <a href="http://vizZzion.org" target="_blank">http://vizZzion.org</a> | GPG Key ID: 9119 0EF9<br>
</font></blockquote></div><br>