Re: [PATCH 2/2] xfs: use offsetof() in place of offset macros for __xfsstats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 10, 2018 at 04:58:53PM +0200, Carlos Maiolino wrote:
> > >  	uint32_t		xs_rmap_2[__XBTS_MAX];
> > > -#define XFSSTAT_END_REFCOUNT		(XFSSTAT_END_RMAP_V2 + __XBTS_MAX)
> > >  	uint32_t		xs_refcbt_2[__XBTS_MAX];
> > > -#define XFSSTAT_END_XQMSTAT		(XFSSTAT_END_REFCOUNT + 6)
> > >  	uint32_t		xs_qm_dqreclaims;
> > >  	uint32_t		xs_qm_dqreclaim_misses;
> > >  	uint32_t		xs_qm_dquot_dups;
> > >  	uint32_t		xs_qm_dqcachemisses;
> > >  	uint32_t		xs_qm_dqcachehits;
> > >  	uint32_t		xs_qm_dqwants;
> > > -#define XFSSTAT_END_QM			(XFSSTAT_END_XQMSTAT+2)
> > >  	uint32_t		xs_qm_dquot;
> > >  	uint32_t		xs_qm_dquot_unused;
> > >  /* Extra precision counters */
> > > @@ -163,10 +139,12 @@ struct __xfsstats {
> > >  	uint64_t		xs_read_bytes;
> > >  };
> > >  
> > > +#define	xfsstats_offset(f)	(offsetof(struct __xfsstats, f)/sizeof(uint32_t))
> > 
> > Goes past 80 columns, but otherwise looks ok,
> > 
> > Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> Ops, sorry, I traded readability+tabs X 80 columns, I think changing the tabs
> for spaces is enough to fix it.
> 
> Do you want me to send it again?

<shrug> If Dave elects to fix it on the way in that's fine with me.

Though I guess so long as I'm being pedantic about things that 'f' ought
to be parentheses-wrapped too, e.g.

#define xfsstats_offset(f) (offsetof(struct __xfsstats, (f)) / sizeof(uint32_t))

--D

> > 
> > --D
> > 
> > 
> > > +
> > >  struct xfsstats {
> > >  	union {
> > >  		struct __xfsstats	s;
> > > -		uint32_t		a[XFSSTAT_END_XQMSTAT];
> > > +		uint32_t		a[xfsstats_offset(xs_qm_dquot)];
> > >  	};
> > >  };
> > >  
> > > -- 
> > > 2.17.1
> > > 
> 
> -- 
> Carlos



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux