diff mbox series

[6/6] xfs: rename the del variable in xfs_reflink_end_cow_extent

Message ID 20240328070256.2918605-7-hch@lst.de (mailing list archive)
State New
Headers show
Series [1/6] xfs: check if_bytes under the ilock in xfs_reflink_end_cow_extent | expand

Commit Message

Christoph Hellwig March 28, 2024, 7:02 a.m. UTC
del contains the new extent that we are remapping.  Give it a somewhat
less confusing name.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_reflink.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

Comments

Darrick J. Wong March 29, 2024, 4:31 p.m. UTC | #1
On Thu, Mar 28, 2024 at 08:02:56AM +0100, Christoph Hellwig wrote:
> del contains the new extent that we are remapping.  Give it a somewhat
> less confusing name.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/xfs_reflink.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index a7ee868d79bf02..15c723396cfdab 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -764,7 +764,7 @@ xfs_reflink_end_cow_extent(
>  	xfs_fileoff_t		end_fsb)
>  {
>  	struct xfs_iext_cursor	icur;
> -	struct xfs_bmbt_irec	got, del;
> +	struct xfs_bmbt_irec	got, new;
>  	struct xfs_mount	*mp = ip->i_mount;
>  	struct xfs_trans	*tp;
>  	struct xfs_ifork	*ifp = xfs_ifork_ptr(ip, XFS_COW_FORK);
> @@ -821,29 +821,29 @@ xfs_reflink_end_cow_extent(
>  	}
>  
>  	/*
> -	 * Preserve @got for the eventual CoW fork deletion; from now on @del
> +	 * Preserve @got for the eventual CoW fork deletion; from now on @new
>  	 * represents the mapping that we're actually remapping.

I'd have called it 'remap' because that's what the comment says.

--D

>  	 */
> -	del = got;
> -	xfs_trim_extent(&del, *offset_fsb, end_fsb - *offset_fsb);
> -	trace_xfs_reflink_cow_remap_from(ip, &del);
> +	new = got;
> +	xfs_trim_extent(&new, *offset_fsb, end_fsb - *offset_fsb);
> +	trace_xfs_reflink_cow_remap_from(ip, &new);
>  
>  	/* Unmap the old data. */
> -	xfs_reflink_unmap_old_data(tp, ip, del.br_startoff,
> -			del.br_startoff + del.br_blockcount);
> +	xfs_reflink_unmap_old_data(tp, ip, new.br_startoff,
> +			new.br_startoff + new.br_blockcount);
>  
>  	/* Free the CoW orphan record. */
> -	xfs_refcount_free_cow_extent(tp, del.br_startblock, del.br_blockcount);
> +	xfs_refcount_free_cow_extent(tp, new.br_startblock, new.br_blockcount);
>  
>  	/* Map the new blocks into the data fork. */
> -	xfs_bmap_map_extent(tp, ip, XFS_DATA_FORK, &del);
> +	xfs_bmap_map_extent(tp, ip, XFS_DATA_FORK, &new);
>  
>  	/* Charge this new data fork mapping to the on-disk quota. */
>  	xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_DELBCOUNT,
> -			(long)del.br_blockcount);
> +			(long)new.br_blockcount);
>  
>  	/* Remove the mapping from the CoW fork. */
> -	xfs_bmap_del_extent_cow(ip, &icur, &got, &del);
> +	xfs_bmap_del_extent_cow(ip, &icur, &got, &new);
>  
>  	error = xfs_trans_commit(tp);
>  	xfs_iunlock(ip, XFS_ILOCK_EXCL);
> @@ -851,7 +851,7 @@ xfs_reflink_end_cow_extent(
>  		return error;
>  
>  	/* Update the caller about how much progress we made. */
> -	*offset_fsb = del.br_startoff + del.br_blockcount;
> +	*offset_fsb = new.br_startoff + new.br_blockcount;
>  	return 0;
>  
>  out_cancel:
> -- 
> 2.39.2
> 
>
Christoph Hellwig March 30, 2024, 5:59 a.m. UTC | #2
On Fri, Mar 29, 2024 at 09:31:08AM -0700, Darrick J. Wong wrote:
> >  	/*
> > -	 * Preserve @got for the eventual CoW fork deletion; from now on @del
> > +	 * Preserve @got for the eventual CoW fork deletion; from now on @new
> >  	 * represents the mapping that we're actually remapping.
> 
> I'd have called it 'remap' because that's what the comment says.

Fine with me.
diff mbox series

Patch

diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index a7ee868d79bf02..15c723396cfdab 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -764,7 +764,7 @@  xfs_reflink_end_cow_extent(
 	xfs_fileoff_t		end_fsb)
 {
 	struct xfs_iext_cursor	icur;
-	struct xfs_bmbt_irec	got, del;
+	struct xfs_bmbt_irec	got, new;
 	struct xfs_mount	*mp = ip->i_mount;
 	struct xfs_trans	*tp;
 	struct xfs_ifork	*ifp = xfs_ifork_ptr(ip, XFS_COW_FORK);
@@ -821,29 +821,29 @@  xfs_reflink_end_cow_extent(
 	}
 
 	/*
-	 * Preserve @got for the eventual CoW fork deletion; from now on @del
+	 * Preserve @got for the eventual CoW fork deletion; from now on @new
 	 * represents the mapping that we're actually remapping.
 	 */
-	del = got;
-	xfs_trim_extent(&del, *offset_fsb, end_fsb - *offset_fsb);
-	trace_xfs_reflink_cow_remap_from(ip, &del);
+	new = got;
+	xfs_trim_extent(&new, *offset_fsb, end_fsb - *offset_fsb);
+	trace_xfs_reflink_cow_remap_from(ip, &new);
 
 	/* Unmap the old data. */
-	xfs_reflink_unmap_old_data(tp, ip, del.br_startoff,
-			del.br_startoff + del.br_blockcount);
+	xfs_reflink_unmap_old_data(tp, ip, new.br_startoff,
+			new.br_startoff + new.br_blockcount);
 
 	/* Free the CoW orphan record. */
-	xfs_refcount_free_cow_extent(tp, del.br_startblock, del.br_blockcount);
+	xfs_refcount_free_cow_extent(tp, new.br_startblock, new.br_blockcount);
 
 	/* Map the new blocks into the data fork. */
-	xfs_bmap_map_extent(tp, ip, XFS_DATA_FORK, &del);
+	xfs_bmap_map_extent(tp, ip, XFS_DATA_FORK, &new);
 
 	/* Charge this new data fork mapping to the on-disk quota. */
 	xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_DELBCOUNT,
-			(long)del.br_blockcount);
+			(long)new.br_blockcount);
 
 	/* Remove the mapping from the CoW fork. */
-	xfs_bmap_del_extent_cow(ip, &icur, &got, &del);
+	xfs_bmap_del_extent_cow(ip, &icur, &got, &new);
 
 	error = xfs_trans_commit(tp);
 	xfs_iunlock(ip, XFS_ILOCK_EXCL);
@@ -851,7 +851,7 @@  xfs_reflink_end_cow_extent(
 		return error;
 
 	/* Update the caller about how much progress we made. */
-	*offset_fsb = del.br_startoff + del.br_blockcount;
+	*offset_fsb = new.br_startoff + new.br_blockcount;
 	return 0;
 
 out_cancel: