Re: DragonFly-2.3.1.497.g0f65b master sys/vfs/hammer hammer.h
Hi Matt,
It seems df is not behaving as we supposed:
> df -h .
Filesystem Size Used Avail Capacity Mounted on
source 5.8G 5.7G 408M 93% /home/source
> dd if=3D/dev/zero of=3Dimg.img bs=3D1m count=3D512
dd: img.img: No space left on device
182+0 records in
181+0 records out
189792256 bytes transferred in 7.020841 secs (27032695 bytes/sec)
> sync
> df .
Filesystem 1K-blocks Used Avail Capacity Mounted on
source 6127616 6167328 221184 97% /home/source
df reports there's more used blocks than the total blocks in the FS.
> sudo /home/antonioh/temp/hinfo /dev/ad0s1a
Volume is ROOT
It has 107 free bigblocks
I think statvfs wasn't updated for some reason :-/
> cat /home/antonioh/temp/hinfo.c
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <strings.h>
#include <unistd.h>
#include <vfs/hammer/hammer_disk.h>
int
main(int argc, char **argv) {
struct hammer_volume_ondisk *od;
int f,r;
if (argc < 2) {
fprintf(stdout, "Wrong number of parameters\n");
exit(EXIT_FAILURE);
}
f =3D open(argv[1], O_RDONLY);
if (f < 0) {
perror("Couldn't open file");
exit(EXIT_FAILURE);
}
od =3D malloc(HAMMER_BUFSIZE);
if (od =3D=3D NULL) {
perror("malloc");
exit(EXIT_FAILURE);
}
bzero(od, HAMMER_BUFSIZE);
r =3D pread(f, od, HAMMER_BUFSIZE, 0);
if (r !=3D HAMMER_BUFSIZE) {
fprintf(stdout, "%s is not a hammer volume\n", argv[1]);
exit(EXIT_FAILURE);
}
fprintf(stdout, "Volume is %s\n", od->vol_name);
fprintf(stdout, "It has %lld free bigblocks\n",
od->vol0_stat_freebigblocks);
return 0;
}
__Antonio
2009/6/25 Matthew Dillon <dillon@crater.dragonflybsd.org>:
>
> commit 0f65be104647b75aea01cc199143fba6a0063982
> Author: Matthew Dillon <dillon@apollo.backplane.com>
> Date: =A0 Thu Jun 25 12:50:50 2009 -0700
>
> =A0 =A0HAMMER VFS - Take reserved space into account when reporting statv=
fs data
>
> =A0 =A0Adjust statvfs data so reserved space is taken into account, so th=
e
> =A0 =A0filesystem starts failing modifying operations closer to when 'df'=
would
> =A0 =A0otherwise say that 0 free space remains.
>
> =A0 =A0Submitted-by: Antonio Huete Jimenez <tuxillo@quantumachine.net> (w=
ith modification)
>
> Summary of changes:
> =A0sys/vfs/hammer/hammer.h =A0 =A0 =A0 =A0 =A0| =A0 11 ++++++++++-
> =A0sys/vfs/hammer/hammer_blockmap.c | =A0 =A04 +++-
> =A0sys/vfs/hammer/hammer_vfsops.c =A0 | =A0 =A04 +++-
> =A03 files changed, 16 insertions(+), 3 deletions(-)
>
> http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/0f65be104647b75ae=
a01cc199143fba6a0063982
>
>
> --
> DragonFly BSD source repository
>
討論串 (同標題文章)
完整討論串 (本文為第 1 之 3 篇):