DragonFly commits List (threaded) for 2009-06
DragonFly BSD
DragonFly commits List (threaded) for 2009-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: DragonFly-2.3.1.497.g0f65b master sys/vfs/hammer hammer.h hammer_blockmap.c hammer_vfsops.c


From: Antonio Huete Jimenez <ahuete.devel@xxxxxxxxx>
Date: Fri, 26 Jun 2009 01:20:39 +0200

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=/dev/zero of=img.img bs=1m count=512
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 = open(argv[1], O_RDONLY);

        if (f < 0) {
                perror("Couldn't open file");
                exit(EXIT_FAILURE);
        }

        od = malloc(HAMMER_BUFSIZE);

        if (od == NULL) {
                perror("malloc");
                exit(EXIT_FAILURE);
        }

        bzero(od, HAMMER_BUFSIZE);

        r = pread(f, od, HAMMER_BUFSIZE, 0);

        if (r != 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:   Thu Jun 25 12:50:50 2009 -0700
>
>    HAMMER VFS - Take reserved space into account when reporting statvfs data
>
>    Adjust statvfs data so reserved space is taken into account, so the
>    filesystem starts failing modifying operations closer to when 'df' would
>    otherwise say that 0 free space remains.
>
>    Submitted-by: Antonio Huete Jimenez <tuxillo@quantumachine.net> (with modification)
>
> Summary of changes:
>  sys/vfs/hammer/hammer.h          |   11 ++++++++++-
>  sys/vfs/hammer/hammer_blockmap.c |    4 +++-
>  sys/vfs/hammer/hammer_vfsops.c   |    4 +++-
>  3 files changed, 16 insertions(+), 3 deletions(-)
>
> http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/0f65be104647b75aea01cc199143fba6a0063982
>
>
> --
> DragonFly BSD source repository
>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]