Re: [PATCH 25/63] xfs: return work remaining at the end of a bunmapi operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Sep 29, 2016 at 08:08:23PM -0700, Darrick J. Wong wrote:
> Return the range of file blocks that bunmapi didn't free.  This hint
> is used by CoW and reflink to figure out what part of an extent
> actually got freed so that it can set up the appropriate atomic
> remapping of just the freed range.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> ---
>  fs/xfs/libxfs/xfs_bmap.c |   36 ++++++++++++++++++++++++++++++------
>  fs/xfs/libxfs/xfs_bmap.h |    4 ++++
>  2 files changed, 34 insertions(+), 6 deletions(-)
> 
> 
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index a5e429e..1e4f1a1 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
...
> @@ -5478,6 +5481,27 @@ xfs_bunmapi(
>  	return error;
>  }
>  
> +/* Unmap a range of a file. */
> +int
> +xfs_bunmapi(
> +	xfs_trans_t		*tp,
> +	struct xfs_inode	*ip,
> +	xfs_fileoff_t		bno,
> +	xfs_filblks_t		len,
> +	int			flags,
> +	xfs_extnum_t		nexts,
> +	xfs_fsblock_t		*firstblock,
> +	struct xfs_defer_ops	*dfops,
> +	int			*done)
> +{
> +	int			error;
> +
> +	error = __xfs_bunmapi(tp, ip, bno, &len, flags, nexts, firstblock,
> +			dfops);
> +	*done = (len == 0);
> +	return error;
> +}
> +

I wonder if we really need such a wrapper for this. There aren't too
many xfs_bunmapi() callers and at least a couple of the few that I
checked don't even use 'done.' That can always get fixed up later
though.

Brian

>  /*
>   * Determine whether an extent shift can be accomplished by a merge with the
>   * extent that precedes the target hole of the shift.
> diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h
> index 53970b1..48ba3ed 100644
> --- a/fs/xfs/libxfs/xfs_bmap.h
> +++ b/fs/xfs/libxfs/xfs_bmap.h
> @@ -197,6 +197,10 @@ int	xfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
>  		xfs_fsblock_t *firstblock, xfs_extlen_t total,
>  		struct xfs_bmbt_irec *mval, int *nmap,
>  		struct xfs_defer_ops *dfops);
> +int	__xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
> +		xfs_fileoff_t bno, xfs_filblks_t *rlen, int flags,
> +		xfs_extnum_t nexts, xfs_fsblock_t *firstblock,
> +		struct xfs_defer_ops *dfops);
>  int	xfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
>  		xfs_fileoff_t bno, xfs_filblks_t len, int flags,
>  		xfs_extnum_t nexts, xfs_fsblock_t *firstblock,
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux