diff mbox series

[05/13] xfs: fix up build warnings when quotas are disabled

Message ID 161181369266.1523592.14023535880347018628.stgit@magnolia (mailing list archive)
State Superseded, archived
Headers show
Series xfs: minor cleanups of the quota functions | expand

Commit Message

Darrick J. Wong Jan. 28, 2021, 6:01 a.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Fix some build warnings on gcc 10.2 when quotas are disabled.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_quota.h |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Brian Foster Jan. 28, 2021, 6:09 p.m. UTC | #1
On Wed, Jan 27, 2021 at 10:01:32PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Fix some build warnings on gcc 10.2 when quotas are disabled.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/xfs_quota.h |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> 
> diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h
> index d1e3f94140b4..72f4cfc49048 100644
> --- a/fs/xfs/xfs_quota.h
> +++ b/fs/xfs/xfs_quota.h
...
> @@ -166,8 +166,8 @@ xfs_trans_reserve_quota_icreate(struct xfs_trans *tp, struct xfs_dquot *udqp,
>  #define xfs_qm_dqattach(ip)						(0)
>  #define xfs_qm_dqattach_locked(ip, fl)					(0)
>  #define xfs_qm_dqdetach(ip)
> -#define xfs_qm_dqrele(d)
> -#define xfs_qm_statvfs(ip, s)
> +#define xfs_qm_dqrele(d)			do { (d) = (d); } while(0)

What's the need for the assignment, out of curiosity?

Regardless, LGTM:

Reviewed-by: Brian Foster <bfoster@redhat.com>

> +#define xfs_qm_statvfs(ip, s)			do { } while(0)
>  #define xfs_qm_newmount(mp, a, b)					(0)
>  #define xfs_qm_mount_quotas(mp)
>  #define xfs_qm_unmount(mp)
>
Darrick J. Wong Jan. 28, 2021, 6:22 p.m. UTC | #2
On Thu, Jan 28, 2021 at 01:09:22PM -0500, Brian Foster wrote:
> On Wed, Jan 27, 2021 at 10:01:32PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Fix some build warnings on gcc 10.2 when quotas are disabled.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > Reviewed-by: Christoph Hellwig <hch@lst.de>
> > ---
> >  fs/xfs/xfs_quota.h |    6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > 
> > diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h
> > index d1e3f94140b4..72f4cfc49048 100644
> > --- a/fs/xfs/xfs_quota.h
> > +++ b/fs/xfs/xfs_quota.h
> ...
> > @@ -166,8 +166,8 @@ xfs_trans_reserve_quota_icreate(struct xfs_trans *tp, struct xfs_dquot *udqp,
> >  #define xfs_qm_dqattach(ip)						(0)
> >  #define xfs_qm_dqattach_locked(ip, fl)					(0)
> >  #define xfs_qm_dqdetach(ip)
> > -#define xfs_qm_dqrele(d)
> > -#define xfs_qm_statvfs(ip, s)
> > +#define xfs_qm_dqrele(d)			do { (d) = (d); } while(0)
> 
> What's the need for the assignment, out of curiosity?

It shuts up a gcc warning about how the dquot pointer is set but never
used.  One hopes the same gcc is smart enough not to generate any code
for this.

--D

> Regardless, LGTM:
> 
> Reviewed-by: Brian Foster <bfoster@redhat.com>
> 
> > +#define xfs_qm_statvfs(ip, s)			do { } while(0)
> >  #define xfs_qm_newmount(mp, a, b)					(0)
> >  #define xfs_qm_mount_quotas(mp)
> >  #define xfs_qm_unmount(mp)
> > 
>
Christoph Hellwig Jan. 28, 2021, 6:23 p.m. UTC | #3
On Thu, Jan 28, 2021 at 10:22:49AM -0800, Darrick J. Wong wrote:
> > > -#define xfs_qm_dqrele(d)
> > > -#define xfs_qm_statvfs(ip, s)
> > > +#define xfs_qm_dqrele(d)			do { (d) = (d); } while(0)
> > 
> > What's the need for the assignment, out of curiosity?
> 
> It shuts up a gcc warning about how the dquot pointer is set but never
> used.  One hopes the same gcc is smart enough not to generate any code
> for this.

The alternative would be to turn these stubs into inline functions,
which would also kill the warning.
diff mbox series

Patch

diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h
index d1e3f94140b4..72f4cfc49048 100644
--- a/fs/xfs/xfs_quota.h
+++ b/fs/xfs/xfs_quota.h
@@ -130,7 +130,7 @@  xfs_qm_vop_dqalloc(struct xfs_inode *ip, kuid_t kuid, kgid_t kgid,
 }
 #define xfs_trans_dup_dqinfo(tp, tp2)
 #define xfs_trans_free_dqinfo(tp)
-#define xfs_trans_mod_dquot_byino(tp, ip, fields, delta)
+#define xfs_trans_mod_dquot_byino(tp, ip, fields, delta) do { } while (0)
 #define xfs_trans_apply_dquot_deltas(tp)
 #define xfs_trans_unreserve_and_mod_dquots(tp)
 static inline int xfs_trans_reserve_quota_nblks(struct xfs_trans *tp,
@@ -166,8 +166,8 @@  xfs_trans_reserve_quota_icreate(struct xfs_trans *tp, struct xfs_dquot *udqp,
 #define xfs_qm_dqattach(ip)						(0)
 #define xfs_qm_dqattach_locked(ip, fl)					(0)
 #define xfs_qm_dqdetach(ip)
-#define xfs_qm_dqrele(d)
-#define xfs_qm_statvfs(ip, s)
+#define xfs_qm_dqrele(d)			do { (d) = (d); } while(0)
+#define xfs_qm_statvfs(ip, s)			do { } while(0)
 #define xfs_qm_newmount(mp, a, b)					(0)
 #define xfs_qm_mount_quotas(mp)
 #define xfs_qm_unmount(mp)