On Thu, Jul 30, 2015 at 11:04:17AM +1000, Dave Chinner wrote: > On Wed, Jul 29, 2015 at 03:34:09PM -0700, Darrick J. Wong wrote: > > Teach the bmap routine to know how to map a range of file blocks to a > > specific range of physical blocks, instead of simply allocating fresh > > blocks. This enables reflink to map a file to blocks that are already > > in use. > > > > Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> > > --- > > fs/xfs/libxfs/xfs_bmap.c | 21 +++++++++++++++++++++ > > fs/xfs/libxfs/xfs_bmap.h | 3 +++ > > 2 files changed, 24 insertions(+) > > > > > > diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c > > index dfdd9e6..1297b94 100644 > > --- a/fs/xfs/libxfs/xfs_bmap.c > > +++ b/fs/xfs/libxfs/xfs_bmap.c > > @@ -3897,6 +3897,15 @@ STATIC int > > xfs_bmap_alloc( > > struct xfs_bmalloca *ap) /* bmap alloc argument struct */ > > { > > + if (ap->flags & XFS_BMAPI_EXACT) { > > + trace_xfs_reflink_relink_blocks(ap->ip, *ap->firstblock, > > + ap->length); > > + ap->blkno = *ap->firstblock; > > + ap->ip->i_d.di_nblocks += ap->length; > > + xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE); > > + return 0; > > + } > > XFS_BMAPI_EXACT is confusing to me - "exact" already means something > in the xfs_bmapi API w.r.t. the XFS_BMAPI_ENTIRE flag. That is, if > XFS_BMAPI_ENTIRE is not set, we want the map returned to span only > the /exact range requested/. If XFS_BMAPI_ENTIRE is set, we want the > entire extent that overlaps the range requested... > > So I think this might be better named to match it's intended > function. e.g. remap, reuse, ref_only, etc. How about XFS_BMAPI_REFLINK? --D > > Cheers, > > Dave. > -- > Dave Chinner > david@xxxxxxxxxxxxx > > _______________________________________________ > xfs mailing list > xfs@xxxxxxxxxxx > http://oss.sgi.com/mailman/listinfo/xfs _______________________________________________ xfs mailing list xfs@xxxxxxxxxxx http://oss.sgi.com/mailman/listinfo/xfs