On Thu, Mar 12, 2015 at 02:03:25AM +0000, Dhruvesh Rathore wrote:
> I have a question about allocation of existing extents to another file, and
> whetherit is possible ?
> A recently created file (temp) can have new extents created using
> lseek64()and the XFS_IOC_RESVP64.These empty extents can be populated by
> copying the data blocks from another file.(The above is mostly done in
> xfs_fsr, the online defragmenter of XFS).
> My question is that can i assign an existing populated extent held by another
> file, to thisnewly created temp file ?
> Any suggestions for the same will be appreciated :)
I think what you're describing is a clone or reflink type operation that
allows extents to be referenced by multiple files at once (e.g., writes
break the references via cow, etc.). Either that, or an extent move
operation that IIUC is something that extN supports. I suspect the
latter is more what you want if the target is defrag. XFS does not
support either at this time, though I think Dave is designing something
that might facilitate reflink down the road.
The only related operation I'm aware of for XFS right now is the swap
extents operation, which swaps the extents between two inodes. xfs_fsr
uses this along with a data copy to defragment files.