[Gllug] DD Ext3 Move
Russell Howe
rhowe at siksai.co.uk
Fri Apr 14 23:14:05 UTC 2006
On Tue, Mar 07, 2006 at 05:23:18PM +0000, Richard Jones wrote:
> On Tue, Mar 07, 2006 at 03:06:49PM +0000, Daniel P. Berrange wrote:
> > I've seen multiple TB sparse files on 64-bit systems. Reading several
> > terrabytes of data to determine where the zeros are is crazy. Of course
> > the app creating the multi-TB sparse file is pretty crazy too, but since
> > the kernel knows the allocation pattern it ought not to be too difficult
> > to let userspace know too, to avoid having to byte scan.
>
> I thought it was already possible to get the file's bmap, using (IIRC)
> ioctl (fd, FIBMAP, ...)?
Another old message replied to (possibly twice?)
XFS has an XFS-specific ioctl for this, exposed to userland via the
xfs_bmap command.
It lets you list the extents occupied by a file. I can't remember how it
exposes sparseness.. maybe you have to work it out by seeing which
regions of the file don't have extents, or maybe it returns a special
extent type..
Running xfs_bmap on a file downloaded via bittorrent is especially
informative.. gazillions of extents, as bittorrent has a nasty habit of
producing heavily fragmented files.
What should be done in this case is preallocation - tell the kernel
"This file I'm writing is going to be about x bytes. Please reserve me
some space". Again, there's an XFS-specific ioctl for this
(XFS_PREALLOC, as it's known). To my knowledge, BT doesn't take
advantage of this ioctl when it detects it's writing to an XFS FS.
What there should probably be, are general Linux ioctls for these
purposes, which individual filesystems are free to implement as they see
fit, but that would require the co-operation of the VFS guys, who aren't
famed for their desire to add extra APIs (and I doubt Viro'd go much for
the API that the XFS_BMAP ioctl has - it's not trivial).
--
Russell Howe | Why be just another cog in the machine,
rhowe at siksai.co.uk | when you can be the spanner in the works?
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list