All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxfs: Fix a couple of sparse complaints
@ 2018-07-13  9:18 Carlos Maiolino
  2018-07-13 10:02 ` Amir Goldstein
  2018-07-13 16:54 ` Darrick J. Wong
  0 siblings, 2 replies; 5+ messages in thread
From: Carlos Maiolino @ 2018-07-13  9:18 UTC (permalink / raw)
  To: linux-xfs

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

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
 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..0680fea1d47d 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 (be32_to_cpu(agi->agi_unlinked[i]) == 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] 5+ messages in thread

* Re: [PATCH] libxfs: Fix a couple of sparse complaints
  2018-07-13  9:18 [PATCH] libxfs: Fix a couple of sparse complaints Carlos Maiolino
@ 2018-07-13 10:02 ` Amir Goldstein
  2018-07-14 10:17   ` Carlos Maiolino
  2018-07-13 16:54 ` Darrick J. Wong
  1 sibling, 1 reply; 5+ messages in thread
From: Amir Goldstein @ 2018-07-13 10:02 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: linux-xfs

On Fri, Jul 13, 2018 at 12:18 PM, Carlos Maiolino <cmaiolino@redhat.com> wrote:
> No significant changes, just silence a couple of sparse errors.
>
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
>  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 };

Could you use args = {} instead.

There was a bunch of conversions for such initializes with:
https://lwn.net/Articles/723997/

But regardless, NULL adds no information for compiler.

Thanks,
Amir.

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

* Re: [PATCH] libxfs: Fix a couple of sparse complaints
  2018-07-13  9:18 [PATCH] libxfs: Fix a couple of sparse complaints Carlos Maiolino
  2018-07-13 10:02 ` Amir Goldstein
@ 2018-07-13 16:54 ` Darrick J. Wong
  2018-07-14 10:09   ` Carlos Maiolino
  1 sibling, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2018-07-13 16:54 UTC (permalink / raw)
  To: Carlos Maiolino; +Cc: linux-xfs

On Fri, Jul 13, 2018 at 11:18:31AM +0200, Carlos Maiolino wrote:
> No significant changes, just silence a couple of sparse errors.
> 
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
>  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..0680fea1d47d 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 (be32_to_cpu(agi->agi_unlinked[i]) == NULLAGINO)

iirc there's enough macro magic in the kernel that
be32_to_cpu(NULLAGINO) will get encoded as a constant so we don't have
to byteswap every bucket in the agi_unlinked array.

--D

>  			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] 5+ messages in thread

* Re: [PATCH] libxfs: Fix a couple of sparse complaints
  2018-07-13 16:54 ` Darrick J. Wong
@ 2018-07-14 10:09   ` Carlos Maiolino
  0 siblings, 0 replies; 5+ messages in thread
From: Carlos Maiolino @ 2018-07-14 10:09 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs

On Fri, Jul 13, 2018 at 09:54:50AM -0700, Darrick J. Wong wrote:
> On Fri, Jul 13, 2018 at 11:18:31AM +0200, Carlos Maiolino wrote:
> > No significant changes, just silence a couple of sparse errors.
> > 
> > Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> > ---
> >  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..0680fea1d47d 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 (be32_to_cpu(agi->agi_unlinked[i]) == NULLAGINO)
> 
> iirc there's enough macro magic in the kernel that
> be32_to_cpu(NULLAGINO) will get encoded as a constant so we don't have
> to byteswap every bucket in the agi_unlinked array.

Yup, you are right, just looked deeper into the be32_to_cpu() and their
relatives, and yeah, constant values can be swapped at compile time, thanks,
I'll redo it, and send a V2

> 
> --D
> 
> >  			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

-- 
Carlos

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

* Re: [PATCH] libxfs: Fix a couple of sparse complaints
  2018-07-13 10:02 ` Amir Goldstein
@ 2018-07-14 10:17   ` Carlos Maiolino
  0 siblings, 0 replies; 5+ messages in thread
From: Carlos Maiolino @ 2018-07-14 10:17 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: linux-xfs

On Fri, Jul 13, 2018 at 01:02:24PM +0300, Amir Goldstein wrote:
> On Fri, Jul 13, 2018 at 12:18 PM, Carlos Maiolino <cmaiolino@redhat.com> wrote:
> > No significant changes, just silence a couple of sparse errors.
> >
> > Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> > ---
> >  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 };
> 
> Could you use args = {} instead.
> 
> There was a bunch of conversions for such initializes with:
> https://lwn.net/Articles/723997/
>

I honestly don't see a reason to use these annotations here.

> But regardless, NULL adds no information for compiler.

args = { NULL }; just looks more clear to me than

args = {};

and anyway, the idea here was just to shut up sparse complains, not to do
anything better than args = {0} or pass any extra information to the compiler.



> 
> Thanks,
> Amir.

-- 
Carlos

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

end of thread, other threads:[~2018-07-14 10:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-13  9:18 [PATCH] libxfs: Fix a couple of sparse complaints Carlos Maiolino
2018-07-13 10:02 ` Amir Goldstein
2018-07-14 10:17   ` Carlos Maiolino
2018-07-13 16:54 ` Darrick J. Wong
2018-07-14 10:09   ` 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.