xfs
[Top] [All Lists]

Re: [PATCH 11/24] xfs: map an inode's offset to an exact physical block

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH 11/24] xfs: map an inode's offset to an exact physical block
From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx>
Date: Thu, 30 Jul 2015 14:09:57 -0700
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20150730010417.GK16638@dastard>
References: <20150729223258.17414.91354.stgit@xxxxxxxxxxxxxxxx> <20150729223409.17414.33569.stgit@xxxxxxxxxxxxxxxx> <20150730010417.GK16638@dastard>
User-agent: Mutt/1.5.21 (2010-09-15)
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

<Prev in Thread] Current Thread [Next in Thread>