xfs
[Top] [All Lists]

Re: df and "Value too large for defined data type"

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>, Eric Sandeen <sandeen@xxxxxxx>
Subject: Re: df and "Value too large for defined data type"
From: James Pearson <james-p@xxxxxxxxxxxxxxxxxx>
Date: Mon, 01 Mar 2004 17:36:53 +0000
Cc: linux-xfs <linux-xfs@xxxxxxxxxxx>
Organization: Moving Picture Company
References: <403DF97D.C717302E@moving-picture.com> <1077904776.7024.5.camel@stout.americas.sgi.com> <20040227181914.A3175@infradead.org>
Sender: linux-xfs-bounce@xxxxxxxxxxx
Christoph Hellwig wrote:
> 
> On Fri, Feb 27, 2004 at 11:59:36AM -0600, Eric Sandeen wrote:
> > the 2.4 statfs interface is 32 bits; I think that until you upgrade the
> > server to 2.6, and (as Christoph tells me) you'll also need a very
> > recent glibc to take advantage of it.
> >
> > On a large filesystem, xfs easily wraps around the ints in the statfs
> > structure.
> 
> Well, in the case of free inodes we might be a bit over-eager and should
> just return some random lower value.  Not that it really matters with
> dynamically allocated inodes..

It looks like some of the ints in statfs under 2.4.X (on i386) will
overflow when you have just over half a terrabyte of free space on an
XFS file system - which I guess is not that big nowadays ...

Here is a simple patch that appears to work OK in my situation - I guess
there would still be an overflow problem if the number of used inodes
reached 2 billion ...

James Pearson

*** xfs_vfsops.c.dist   Tue Sep 16 12:14:03 2003
--- xfs_vfsops.c        Mon Mar  1 16:36:35 2004
***************
*** 788,799 ****
        lsize = sbp->sb_logstart ? sbp->sb_logblocks : 0;
        statp->f_blocks = sbp->sb_dblocks - lsize;
        statp->f_bfree = statp->f_bavail = sbp->sb_fdblocks;
!       fakeinos = statp->f_bfree << sbp->sb_inopblog;
  #if XFS_BIG_FILESYSTEMS
        fakeinos += mp->m_inoadd;
  #endif
        statp->f_files =
!           MIN(sbp->sb_icount + fakeinos, (__uint64_t)XFS_MAXINUMBER);
        if (mp->m_maxicount)
  #if XFS_BIG_FILESYSTEMS
                if (!mp->m_inoadd)
--- 788,799 ----
        lsize = sbp->sb_logstart ? sbp->sb_logblocks : 0;
        statp->f_blocks = sbp->sb_dblocks - lsize;
        statp->f_bfree = statp->f_bavail = sbp->sb_fdblocks;
!       fakeinos = (__uint64_t) statp->f_bfree << sbp->sb_inopblog;
  #if XFS_BIG_FILESYSTEMS
        fakeinos += mp->m_inoadd;
  #endif
        statp->f_files =
!           MIN(sbp->sb_icount + fakeinos, (__uint64_t)((1ULL << 31) -
1ULL));
        if (mp->m_maxicount)
  #if XFS_BIG_FILESYSTEMS
                if (!mp->m_inoadd)


<Prev in Thread] Current Thread [Next in Thread>
  • Re: df and "Value too large for defined data type", James Pearson <=