]> git.baikalelectronics.ru Git - kernel.git/commit
xfs: use offsetof() in place of offset macros for __xfsstats
authorCarlos Maiolino <cmaiolino@redhat.com>
Thu, 18 Oct 2018 06:21:39 +0000 (17:21 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 18 Oct 2018 06:21:39 +0000 (17:21 +1100)
commit7a5ef6aceed8f0a924c67400242ea509f009512f
tree7008ec8f6605d864c0bc7c7449ddb2139ae98b95
parenta8209e0101d67484035b15e87c0edc273b2b8e55
xfs: use offsetof() in place of offset macros for __xfsstats

Most offset macro mess is used in xfs_stats_format() only, and we can
simply get the right offsets using offsetof(), instead of several macros
to mark the offsets inside __xfsstats structure.

Replace all XFSSTAT_END_* macros by a single helper macro to get the
right offset into __xfsstats, and use this helper in xfs_stats_format()
directly.

The quota stats code, still looks a bit cleaner when using XFSSTAT_*
macros, so, this patch also defines XFSSTAT_START_XQMSTAT and
XFSSTAT_END_XQMSTAT locally to that code. This also should prevent
offset mistakes when updates are done into __xfsstats.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_stats.c
fs/xfs/xfs_stats.h