Index: /trunk/Nebulous-Server/bin/nebdiskd
===================================================================
--- /trunk/Nebulous-Server/bin/nebdiskd	(revision 19870)
+++ /trunk/Nebulous-Server/bin/nebdiskd	(revision 19871)
@@ -3,5 +3,5 @@
 # Copyright (C) 2007  Joshua Hoblitt
 # 
-# $Id: nebdiskd,v 1.8 2008-10-01 20:42:31 jhoblitt Exp $
+# $Id: nebdiskd,v 1.9 2008-10-03 00:41:55 jhoblitt Exp $
 
 use strict;
@@ -106,5 +106,11 @@
 
         eval {
-            my @valid_mounts;
+            # empty the mount table
+            $dbh->do("DELETE FROM mount");
+            print "flushed mount table\n" if $debug;
+
+            # repopulate the mount table with all valid mounts that we are
+            # supposed to be watching
+            my $query = $dbh->prepare_cached("INSERT INTO mount VALUES(?, ?, ?)");
 
             # determine valid mountpoints
@@ -123,17 +129,8 @@
                     next;
                 }
-                push @valid_mounts, $mnt;
-            }
-            # empty the mount table
-            $dbh->do("DELETE FROM mount");
-            print "flushed mount table\n" if $debug;
-
-            # repopulate the mount table with all valid mounts that we are
-            # supposed to be watching
-            my $query = $dbh->prepare_cached("INSERT INTO mount VALUES(?, ?, ?)");
-            # get stats on all currently mounted volumes
-            # this has to be done AFTER we determine what the valid mountpoints
-            # are incase is_mountpoint() invokes the automounter
-            foreach my $mnt (@valid_mounts) {
+
+                # fetch stats on the mounted device.  this has to be done AFTER
+                # we determine if it's a valid mountpoint incase
+                # is_mountpoint() invokes the automounter
                 my $dev_info = df($mnt, 1024);
                 unless (defined $dev_info) {
@@ -141,6 +138,8 @@
                     next;
                 }
+
                 $query->execute($mnt, @$dev_info{qw( blocks used )});
                 print "adding $mnt to db\n" if $debug;
+
             }
 
@@ -281,19 +280,4 @@
 
 
-sub fix_disk_stats
-{
-    my $stats = shift;
-
-    # take the hash returned by Sys::Statistics::Linux::DiskUsage->new->get and
-    # replace the keynames with those of the mountpoint for each device
-    my %new_stats;
-    foreach my $key (keys %$stats) {
-        my $disk = $stats->{$key};
-        $new_stats{$disk->{mountpoint}} = $disk;
-    }
-
-    return \%new_stats;
-}
-
 __END__
 
