patch to fix disk usage numbers on FreeBSD
Brad Fitzpatrick
brad at danga.com
Tue Jan 16 19:05:47 UTC 2007
Checked in... sorry for delay:
http://code.sixapart.com/trac/mogilefs/changeset/706
Also detect 512 byte returns and just divide by two...
http://code.sixapart.com/trac/mogilefs/changeset/707
On Fri, 8 Dec 2006, Doug Porter wrote:
> The current version of MogileFS doubles all the disk space numbers on
> FreeBSD due to FreeBSD's df working differently than GNU coreutils df.
> If the -P option follows -k with FreeBSD df the blocksize will be
> 512 bytes. The following patch remedies this problem and seems to
> produce the correct results on both FreeBSD and Linux.
>
>
>
> Index: server/mogstored
> ===================================================================
> --- server/mogstored (revision 518)
> +++ server/mogstored (working copy)
> @@ -259,7 +259,7 @@
> my ($osdevnum) = stat("$path/$devnum");
> $devnum_to_device{$devnum} = $osdevnum_to_device{$osdevnum};
>
> - my $rval = `df -k -l -P $path/$devnum`;
> + my $rval = `df -P -l -k $path/$devnum`;
> foreach my $l (split /\r?\n/, $rval) {
> next unless $l =~ /^(.+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(.+)\s+(.+)$/;
> my ($dev, $total, $used, $avail, $useper, $disk) = ($1, $2, $3, $4, $5, $6);
>
>
>
> --
> Doug Porter <dsp at dsp.name>
>
>
More information about the mogilefs
mailing list