>
> How can I make holes where there is currently data with XFS?
>
> Can I lop off the front of a file easily?
>
> Thanks,
> Ian Nelson
There is an ioctl to unreserve space in a file from a file. This part of
XFS has not had much exposure and is known to have problems when there
is data still present in buffers which overlaps the place a hole is being
created.
XFS_IOC_FREESP is the ioctl code, include/linux/xfs_fs.h defines the types
and ioctl codes for this. Here is an extract from the irix man page, I do
not think we have any documentation for this on Linux right now (so this
is not correct when it comes to type names and header files).
F_FREESP Alter storage space associated with a section of the ordinary
file fildes. The section is specified by a variable of data
type struct flock pointed to by the third argument arg. The
data type struct flock is defined in the <fcntl.h> header file
[see fcntl(5)] and contains the following members: l_whence is
0, 1, or 2 to indicate that the relative offset l_start will be
measured from the start of the file, the current position, or
the end of the file, respectively. l_start is the offset from
the position specified in l_whence. l_len is the size of the
section. An l_len of 0 frees up to the end of the file; in
this case, the end of file (i.e., file size) is set to the
beginning of the section freed. Any data previously written
into this section is no longer accessible. If the section
specified is beyond the current end of file, the file is grown
and filled with zeroes. The l_len field is currently ignored,
and should be set to 0.
The structure you would pass in would be of type xfs_flock64
Steve
|