[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Preallocation and Ferris
monkeyiq wrote:
>Hi,
> A while back I was talking about adding preallocation support to
>ferris. I didn't get around to adding it at the time, though the
>doco seems much better now and I have an application which would
>be greatly enhanced using it.
>
>I have found the calls in xfs(5)
>XFS_IOC_FSGETXATTR
>XFS_IOC_RESVSP64
>XFS_IOC_UNRESVSP64
>
>I am thinking of adding an interface though Ferris using both
>Ferris' support for arbitrary creation arguments
>(see http://witme.sourceforge.net/ferriscreate.paper2001/ )
>and also creating a "fake" EA for preallocation-eof
>which can be set to whatever size is wanted in the preallocation.
>The main question I have here is how to obtain the current
>amount of space that is preallocated in the file and not used.
>
>It seems from RTFM that XFS_IOC_FSGETXATTR only tells if
>preallocation is being used. If I can tell how much space
>a file has preallocated at eof then I can add a new EA and
>edit it with the client shown here:
>http://witme.sourceforge.net/libferris.web/Ego-Jan-2002-1.png
>
>This would allow a nice interface for preallocation and make
>scripting easy to be able to check for files that have been
>written but are smaller than the space originally preallocated
>to them.
>
>Thoughts?
>
It is possible to query xfs to find out all sorts of stuff about the
layout of a
file, take a look at the xfs_bmap program and its source code. If you are
not creating files with holes in then a simple stat system call will
suffice,
the st_blocks will include preallocated space beyond the end of file.
Steve