All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxfs: fix confusing xfs_extent_item variable names
@ 2023-05-10 19:56 ` Darrick J. Wong
  2023-05-11 13:35   ` Carlos Maiolino
  0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2023-05-10 19:56 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: linux-xfs

From: Darrick J. Wong <djwong@kernel.org>

Change the name of all pointers to xfs_extent_item structures to "xefi"
to make the name consistent and because the current selections ("new"
and "free") mean other things in C.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 libxfs/defer_item.c |   41 +++++++++++++++++++++++------------------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c
index b95b54e5..2e9912f8 100644
--- a/libxfs/defer_item.c
+++ b/libxfs/defer_item.c
@@ -80,18 +80,20 @@ xfs_extent_free_finish_item(
 	struct xfs_btree_cur		**state)
 {
 	struct xfs_owner_info		oinfo = { };
-	struct xfs_extent_free_item	*free;
+	struct xfs_extent_free_item	*xefi;
 	int				error;
 
-	free = container_of(item, struct xfs_extent_free_item, xefi_list);
-	oinfo.oi_owner = free->xefi_owner;
-	if (free->xefi_flags & XFS_EFI_ATTR_FORK)
+	xefi = container_of(item, struct xfs_extent_free_item, xefi_list);
+
+	oinfo.oi_owner = xefi->xefi_owner;
+	if (xefi->xefi_flags & XFS_EFI_ATTR_FORK)
 		oinfo.oi_flags |= XFS_OWNER_INFO_ATTR_FORK;
-	if (free->xefi_flags & XFS_EFI_BMBT_BLOCK)
+	if (xefi->xefi_flags & XFS_EFI_BMBT_BLOCK)
 		oinfo.oi_flags |= XFS_OWNER_INFO_BMBT_BLOCK;
-	error = xfs_free_extent(tp, free->xefi_startblock,
-		free->xefi_blockcount, &oinfo, XFS_AG_RESV_NONE);
-	kmem_cache_free(xfs_extfree_item_cache, free);
+	error = xfs_free_extent(tp, xefi->xefi_startblock,
+			xefi->xefi_blockcount, &oinfo, XFS_AG_RESV_NONE);
+
+	kmem_cache_free(xfs_extfree_item_cache, xefi);
 	return error;
 }
 
@@ -107,10 +109,11 @@ STATIC void
 xfs_extent_free_cancel_item(
 	struct list_head		*item)
 {
-	struct xfs_extent_free_item	*free;
+	struct xfs_extent_free_item	*xefi;
 
-	free = container_of(item, struct xfs_extent_free_item, xefi_list);
-	kmem_cache_free(xfs_extfree_item_cache, free);
+	xefi = container_of(item, struct xfs_extent_free_item, xefi_list);
+
+	kmem_cache_free(xfs_extfree_item_cache, xefi);
 }
 
 const struct xfs_defer_op_type xfs_extent_free_defer_type = {
@@ -134,25 +137,27 @@ xfs_agfl_free_finish_item(
 {
 	struct xfs_owner_info		oinfo = { };
 	struct xfs_mount		*mp = tp->t_mountp;
-	struct xfs_extent_free_item	*free;
+	struct xfs_extent_free_item	*xefi;
 	struct xfs_buf			*agbp;
 	struct xfs_perag		*pag;
 	int				error;
 	xfs_agnumber_t			agno;
 	xfs_agblock_t			agbno;
 
-	free = container_of(item, struct xfs_extent_free_item, xefi_list);
-	ASSERT(free->xefi_blockcount == 1);
-	agno = XFS_FSB_TO_AGNO(mp, free->xefi_startblock);
-	agbno = XFS_FSB_TO_AGBNO(mp, free->xefi_startblock);
-	oinfo.oi_owner = free->xefi_owner;
+	xefi = container_of(item, struct xfs_extent_free_item, xefi_list);
+
+	ASSERT(xefi->xefi_blockcount == 1);
+	agno = XFS_FSB_TO_AGNO(mp, xefi->xefi_startblock);
+	agbno = XFS_FSB_TO_AGBNO(mp, xefi->xefi_startblock);
+	oinfo.oi_owner = xefi->xefi_owner;
 
 	pag = libxfs_perag_get(mp, agno);
 	error = xfs_alloc_read_agf(pag, tp, 0, &agbp);
 	if (!error)
 		error = xfs_free_agfl_block(tp, agno, agbno, agbp, &oinfo);
 	libxfs_perag_put(pag);
-	kmem_cache_free(xfs_extfree_item_cache, free);
+
+	kmem_cache_free(xfs_extfree_item_cache, xefi);
 	return error;
 }
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libxfs: fix confusing xfs_extent_item variable names
  2023-05-10 19:56 ` [PATCH] libxfs: fix confusing xfs_extent_item variable names Darrick J. Wong
@ 2023-05-11 13:35   ` Carlos Maiolino
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos Maiolino @ 2023-05-11 13:35 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs

On Wed, May 10, 2023 at 12:56:17PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Change the name of all pointers to xfs_extent_item structures to "xefi"
> to make the name consistent and because the current selections ("new"
> and "free") mean other things in C.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Sounds good, thanks!
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>

> ---
>  libxfs/defer_item.c |   41 +++++++++++++++++++++++------------------
>  1 file changed, 23 insertions(+), 18 deletions(-)
> 
> diff --git a/libxfs/defer_item.c b/libxfs/defer_item.c
> index b95b54e5..2e9912f8 100644
> --- a/libxfs/defer_item.c
> +++ b/libxfs/defer_item.c
> @@ -80,18 +80,20 @@ xfs_extent_free_finish_item(
>  	struct xfs_btree_cur		**state)
>  {
>  	struct xfs_owner_info		oinfo = { };
> -	struct xfs_extent_free_item	*free;
> +	struct xfs_extent_free_item	*xefi;
>  	int				error;
> 
> -	free = container_of(item, struct xfs_extent_free_item, xefi_list);
> -	oinfo.oi_owner = free->xefi_owner;
> -	if (free->xefi_flags & XFS_EFI_ATTR_FORK)
> +	xefi = container_of(item, struct xfs_extent_free_item, xefi_list);
> +
> +	oinfo.oi_owner = xefi->xefi_owner;
> +	if (xefi->xefi_flags & XFS_EFI_ATTR_FORK)
>  		oinfo.oi_flags |= XFS_OWNER_INFO_ATTR_FORK;
> -	if (free->xefi_flags & XFS_EFI_BMBT_BLOCK)
> +	if (xefi->xefi_flags & XFS_EFI_BMBT_BLOCK)
>  		oinfo.oi_flags |= XFS_OWNER_INFO_BMBT_BLOCK;
> -	error = xfs_free_extent(tp, free->xefi_startblock,
> -		free->xefi_blockcount, &oinfo, XFS_AG_RESV_NONE);
> -	kmem_cache_free(xfs_extfree_item_cache, free);
> +	error = xfs_free_extent(tp, xefi->xefi_startblock,
> +			xefi->xefi_blockcount, &oinfo, XFS_AG_RESV_NONE);
> +
> +	kmem_cache_free(xfs_extfree_item_cache, xefi);
>  	return error;
>  }
> 
> @@ -107,10 +109,11 @@ STATIC void
>  xfs_extent_free_cancel_item(
>  	struct list_head		*item)
>  {
> -	struct xfs_extent_free_item	*free;
> +	struct xfs_extent_free_item	*xefi;
> 
> -	free = container_of(item, struct xfs_extent_free_item, xefi_list);
> -	kmem_cache_free(xfs_extfree_item_cache, free);
> +	xefi = container_of(item, struct xfs_extent_free_item, xefi_list);
> +
> +	kmem_cache_free(xfs_extfree_item_cache, xefi);
>  }
> 
>  const struct xfs_defer_op_type xfs_extent_free_defer_type = {
> @@ -134,25 +137,27 @@ xfs_agfl_free_finish_item(
>  {
>  	struct xfs_owner_info		oinfo = { };
>  	struct xfs_mount		*mp = tp->t_mountp;
> -	struct xfs_extent_free_item	*free;
> +	struct xfs_extent_free_item	*xefi;
>  	struct xfs_buf			*agbp;
>  	struct xfs_perag		*pag;
>  	int				error;
>  	xfs_agnumber_t			agno;
>  	xfs_agblock_t			agbno;
> 
> -	free = container_of(item, struct xfs_extent_free_item, xefi_list);
> -	ASSERT(free->xefi_blockcount == 1);
> -	agno = XFS_FSB_TO_AGNO(mp, free->xefi_startblock);
> -	agbno = XFS_FSB_TO_AGBNO(mp, free->xefi_startblock);
> -	oinfo.oi_owner = free->xefi_owner;
> +	xefi = container_of(item, struct xfs_extent_free_item, xefi_list);
> +
> +	ASSERT(xefi->xefi_blockcount == 1);
> +	agno = XFS_FSB_TO_AGNO(mp, xefi->xefi_startblock);
> +	agbno = XFS_FSB_TO_AGBNO(mp, xefi->xefi_startblock);
> +	oinfo.oi_owner = xefi->xefi_owner;
> 
>  	pag = libxfs_perag_get(mp, agno);
>  	error = xfs_alloc_read_agf(pag, tp, 0, &agbp);
>  	if (!error)
>  		error = xfs_free_agfl_block(tp, agno, agbno, agbp, &oinfo);
>  	libxfs_perag_put(pag);
> -	kmem_cache_free(xfs_extfree_item_cache, free);
> +
> +	kmem_cache_free(xfs_extfree_item_cache, xefi);
>  	return error;
>  }
> 

-- 
Carlos Maiolino

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-11 13:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <0kaspVe46GjWH34UplQpBKZYm9TFMd-VCgmBlNr5UbWao_BKBsNdO8xn06_SqVveitqg5wLOXPd-St5SXH5Aag==@protonmail.internalid>
2023-05-10 19:56 ` [PATCH] libxfs: fix confusing xfs_extent_item variable names Darrick J. Wong
2023-05-11 13:35   ` Carlos Maiolino

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.