linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] libxfs: Fix a couple of sparse complaintis
@ 2018-07-17  9:45 Carlos Maiolino
  2018-07-17 17:13 ` Darrick J. Wong
  2018-07-17 17:25 ` Bill O'Donnell
  0 siblings, 2 replies; 3+ messages in thread
From: Carlos Maiolino @ 2018-07-17  9:45 UTC (permalink / raw)
  To: linux-xfs

No significant changes, just silence a couple of sparse errors.

Using cpu_to_be32(NULLAGINO), the NULLAGINO constant will be encoded in
BE as a constant, avoiding a BE -> CPU conversion every iteraction of
the loop, if be32_to_cpu(agi->agi_unlinked[i]) was used instead.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---

V2:
	Convert NULLAGINO to BE32 instead of converting agi_unlinked[i] to cpu

 fs/xfs/libxfs/xfs_ag_resv.h | 2 +-
 fs/xfs/libxfs/xfs_ialloc.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_ag_resv.h b/fs/xfs/libxfs/xfs_ag_resv.h
index 4619b554ee90..dc953fc84b2f 100644
--- a/fs/xfs/libxfs/xfs_ag_resv.h
+++ b/fs/xfs/libxfs/xfs_ag_resv.h
@@ -28,7 +28,7 @@ xfs_ag_resv_rmapbt_alloc(
 	struct xfs_mount	*mp,
 	xfs_agnumber_t		agno)
 {
-	struct xfs_alloc_arg	args = {0};
+	struct xfs_alloc_arg	args = { NULL };
 	struct xfs_perag	*pag;
 
 	args.len = 1;
diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
index 0d968e8143aa..9a6bada8a919 100644
--- a/fs/xfs/libxfs/xfs_ialloc.c
+++ b/fs/xfs/libxfs/xfs_ialloc.c
@@ -2539,7 +2539,7 @@ xfs_agi_verify(
 		return __this_address;
 
 	for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++) {
-		if (agi->agi_unlinked[i] == NULLAGINO)
+		if (agi->agi_unlinked[i] == cpu_to_be32(NULLAGINO))
 			continue;
 		if (!xfs_verify_ino(mp, be32_to_cpu(agi->agi_unlinked[i])))
 			return __this_address;
-- 
2.14.3


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

* Re: [PATCH V2] libxfs: Fix a couple of sparse complaintis
  2018-07-17  9:45 [PATCH V2] libxfs: Fix a couple of sparse complaintis Carlos Maiolino
@ 2018-07-17 17:13 ` Darrick J. Wong
  2018-07-17 17:25 ` Bill O'Donnell
  1 sibling, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2018-07-17 17:13 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: linux-xfs

On Tue, Jul 17, 2018 at 11:45:44AM +0200, Carlos Maiolino wrote:
> No significant changes, just silence a couple of sparse errors.
> 
> Using cpu_to_be32(NULLAGINO), the NULLAGINO constant will be encoded in
> BE as a constant, avoiding a BE -> CPU conversion every iteraction of
> the loop, if be32_to_cpu(agi->agi_unlinked[i]) was used instead.
> 
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>

Looks ok, will test...
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
> 
> V2:
> 	Convert NULLAGINO to BE32 instead of converting agi_unlinked[i] to cpu
> 
>  fs/xfs/libxfs/xfs_ag_resv.h | 2 +-
>  fs/xfs/libxfs/xfs_ialloc.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_ag_resv.h b/fs/xfs/libxfs/xfs_ag_resv.h
> index 4619b554ee90..dc953fc84b2f 100644
> --- a/fs/xfs/libxfs/xfs_ag_resv.h
> +++ b/fs/xfs/libxfs/xfs_ag_resv.h
> @@ -28,7 +28,7 @@ xfs_ag_resv_rmapbt_alloc(
>  	struct xfs_mount	*mp,
>  	xfs_agnumber_t		agno)
>  {
> -	struct xfs_alloc_arg	args = {0};
> +	struct xfs_alloc_arg	args = { NULL };
>  	struct xfs_perag	*pag;
>  
>  	args.len = 1;
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index 0d968e8143aa..9a6bada8a919 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -2539,7 +2539,7 @@ xfs_agi_verify(
>  		return __this_address;
>  
>  	for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++) {
> -		if (agi->agi_unlinked[i] == NULLAGINO)
> +		if (agi->agi_unlinked[i] == cpu_to_be32(NULLAGINO))
>  			continue;
>  		if (!xfs_verify_ino(mp, be32_to_cpu(agi->agi_unlinked[i])))
>  			return __this_address;
> -- 
> 2.14.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH V2] libxfs: Fix a couple of sparse complaintis
  2018-07-17  9:45 [PATCH V2] libxfs: Fix a couple of sparse complaintis Carlos Maiolino
  2018-07-17 17:13 ` Darrick J. Wong
@ 2018-07-17 17:25 ` Bill O'Donnell
  1 sibling, 0 replies; 3+ messages in thread
From: Bill O'Donnell @ 2018-07-17 17:25 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: linux-xfs

On Tue, Jul 17, 2018 at 11:45:44AM +0200, Carlos Maiolino wrote:
> No significant changes, just silence a couple of sparse errors.
> 
> Using cpu_to_be32(NULLAGINO), the NULLAGINO constant will be encoded in
> BE as a constant, avoiding a BE -> CPU conversion every iteraction of
> the loop, if be32_to_cpu(agi->agi_unlinked[i]) was used instead.
> 
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---

looks fine.
Reviewed-by: Bill O'Donnell <billodo@redhat.com>

> 
> V2:
> 	Convert NULLAGINO to BE32 instead of converting agi_unlinked[i] to cpu
> 
>  fs/xfs/libxfs/xfs_ag_resv.h | 2 +-
>  fs/xfs/libxfs/xfs_ialloc.c  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_ag_resv.h b/fs/xfs/libxfs/xfs_ag_resv.h
> index 4619b554ee90..dc953fc84b2f 100644
> --- a/fs/xfs/libxfs/xfs_ag_resv.h
> +++ b/fs/xfs/libxfs/xfs_ag_resv.h
> @@ -28,7 +28,7 @@ xfs_ag_resv_rmapbt_alloc(
>  	struct xfs_mount	*mp,
>  	xfs_agnumber_t		agno)
>  {
> -	struct xfs_alloc_arg	args = {0};
> +	struct xfs_alloc_arg	args = { NULL };
>  	struct xfs_perag	*pag;
>  
>  	args.len = 1;
> diff --git a/fs/xfs/libxfs/xfs_ialloc.c b/fs/xfs/libxfs/xfs_ialloc.c
> index 0d968e8143aa..9a6bada8a919 100644
> --- a/fs/xfs/libxfs/xfs_ialloc.c
> +++ b/fs/xfs/libxfs/xfs_ialloc.c
> @@ -2539,7 +2539,7 @@ xfs_agi_verify(
>  		return __this_address;
>  
>  	for (i = 0; i < XFS_AGI_UNLINKED_BUCKETS; i++) {
> -		if (agi->agi_unlinked[i] == NULLAGINO)
> +		if (agi->agi_unlinked[i] == cpu_to_be32(NULLAGINO))
>  			continue;
>  		if (!xfs_verify_ino(mp, be32_to_cpu(agi->agi_unlinked[i])))
>  			return __this_address;
> -- 
> 2.14.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2018-07-17 17:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-17  9:45 [PATCH V2] libxfs: Fix a couple of sparse complaintis Carlos Maiolino
2018-07-17 17:13 ` Darrick J. Wong
2018-07-17 17:25 ` Bill O'Donnell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).