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

Darrick J. Wong
2021-01-28T18:32:39Z

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