diff mbox series

xfs: port xfs/122 to the kernel

Message ID 20241011182407.GC21853@frogsfrogsfrogs (mailing list archive)
State New
Headers show
Series xfs: port xfs/122 to the kernel | expand

Commit Message

Darrick J. Wong Oct. 11, 2024, 6:24 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Check this with every kernel and userspace build, so we can drop the
nonsense in xfs/122.  Roughly drafted with:

sed -e 's/^offsetof/\tXFS_CHECK_OFFSET/g' \
	-e 's/^sizeof/\tXFS_CHECK_STRUCT_SIZE/g' \
	-e 's/ = \([0-9]*\)/,\t\t\t\1);/g' \
	-e 's/xfs_sb_t/struct xfs_dsb/g' \
	-e 's/),/,/g' \
	-e 's/xfs_\([a-z0-9_]*\)_t,/struct xfs_\1,/g' \
	< tests/xfs/122.out | sort

and then manual fixups.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/libxfs/xfs_ondisk.h |  111 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 110 insertions(+), 1 deletion(-)

Comments

Christoph Hellwig Oct. 14, 2024, 6:03 a.m. UTC | #1
On Fri, Oct 11, 2024 at 11:24:07AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Check this with every kernel and userspace build, so we can drop the
> nonsense in xfs/122.  Roughly drafted with:

Is ondisk.h the right file for checks on ioctl structures?  Otherwise
looks good.
Darrick J. Wong Oct. 14, 2024, 3:25 p.m. UTC | #2
On Sun, Oct 13, 2024 at 11:03:55PM -0700, Christoph Hellwig wrote:
> On Fri, Oct 11, 2024 at 11:24:07AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Check this with every kernel and userspace build, so we can drop the
> > nonsense in xfs/122.  Roughly drafted with:
> 
> Is ondisk.h the right file for checks on ioctl structures?  Otherwise
> looks good.

Dunno -- maybe those should go in xfs_fs.h, but I'm hesitant to ship
that kind of noise to every customer. :)

--D
kernel test robot Oct. 15, 2024, 12:34 a.m. UTC | #3
Hi Darrick,

kernel test robot noticed the following build errors:

[auto build test ERROR on xfs-linux/for-next]
[also build test ERROR on linus/master v6.12-rc3 next-20241014]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Darrick-J-Wong/xfs-port-xfs-122-to-the-kernel/20241012-022552
base:   https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git for-next
patch link:    https://lore.kernel.org/r/20241011182407.GC21853%40frogsfrogsfrogs
patch subject: [PATCH] xfs: port xfs/122 to the kernel
config: i386-buildonly-randconfig-001-20241015 (https://download.01.org/0day-ci/archive/20241015/202410150820.elwPtYkE-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241015/202410150820.elwPtYkE-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410150820.elwPtYkE-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/container_of.h:5,
                    from include/linux/list.h:5,
                    from include/linux/semaphore.h:11,
                    from fs/xfs/xfs_linux.h:24,
                    from fs/xfs/xfs.h:26,
                    from fs/xfs/xfs_super.c:7:
   fs/xfs/libxfs/xfs_ondisk.h: In function 'xfs_check_ondisk_structs':
>> include/linux/build_bug.h:78:41: error: static assertion failed: "XFS: sizeof(struct xfs_fsop_geom_v1) is wrong, expected 112"
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                         ^~~~~~~~~~~~~~
   include/linux/build_bug.h:77:34: note: in expansion of macro '__static_assert'
      77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
         |                                  ^~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ondisk.h:10:9: note: in expansion of macro 'static_assert'
      10 |         static_assert(sizeof(structname) == (size), \
         |         ^~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ondisk.h:302:9: note: in expansion of macro 'XFS_CHECK_STRUCT_SIZE'
     302 |         XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v1,                  112);
         |         ^~~~~~~~~~~~~~~~~~~~~


vim +78 include/linux/build_bug.h

bc6245e5efd70c4 Ian Abbott       2017-07-10  60  
6bab69c65013bed Rasmus Villemoes 2019-03-07  61  /**
6bab69c65013bed Rasmus Villemoes 2019-03-07  62   * static_assert - check integer constant expression at build time
6bab69c65013bed Rasmus Villemoes 2019-03-07  63   *
6bab69c65013bed Rasmus Villemoes 2019-03-07  64   * static_assert() is a wrapper for the C11 _Static_assert, with a
6bab69c65013bed Rasmus Villemoes 2019-03-07  65   * little macro magic to make the message optional (defaulting to the
6bab69c65013bed Rasmus Villemoes 2019-03-07  66   * stringification of the tested expression).
6bab69c65013bed Rasmus Villemoes 2019-03-07  67   *
6bab69c65013bed Rasmus Villemoes 2019-03-07  68   * Contrary to BUILD_BUG_ON(), static_assert() can be used at global
6bab69c65013bed Rasmus Villemoes 2019-03-07  69   * scope, but requires the expression to be an integer constant
6bab69c65013bed Rasmus Villemoes 2019-03-07  70   * expression (i.e., it is not enough that __builtin_constant_p() is
6bab69c65013bed Rasmus Villemoes 2019-03-07  71   * true for expr).
6bab69c65013bed Rasmus Villemoes 2019-03-07  72   *
6bab69c65013bed Rasmus Villemoes 2019-03-07  73   * Also note that BUILD_BUG_ON() fails the build if the condition is
6bab69c65013bed Rasmus Villemoes 2019-03-07  74   * true, while static_assert() fails the build if the expression is
6bab69c65013bed Rasmus Villemoes 2019-03-07  75   * false.
6bab69c65013bed Rasmus Villemoes 2019-03-07  76   */
6bab69c65013bed Rasmus Villemoes 2019-03-07  77  #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
6bab69c65013bed Rasmus Villemoes 2019-03-07 @78  #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
6bab69c65013bed Rasmus Villemoes 2019-03-07  79  
07a368b3f55a79d Maxim Levitsky   2022-10-25  80
kernel test robot Oct. 15, 2024, 1:04 a.m. UTC | #4
Hi Darrick,

kernel test robot noticed the following build errors:

[auto build test ERROR on xfs-linux/for-next]
[also build test ERROR on linus/master v6.12-rc3 next-20241014]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Darrick-J-Wong/xfs-port-xfs-122-to-the-kernel/20241012-022552
base:   https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git for-next
patch link:    https://lore.kernel.org/r/20241011182407.GC21853%40frogsfrogsfrogs
patch subject: [PATCH] xfs: port xfs/122 to the kernel
config: i386-buildonly-randconfig-003-20241015 (https://download.01.org/0day-ci/archive/20241015/202410150814.TljkPzs5-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241015/202410150814.TljkPzs5-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410150814.TljkPzs5-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from fs/xfs/xfs_super.c:33:
>> fs/xfs/libxfs/xfs_ondisk.h:302:2: error: static assertion failed due to requirement 'sizeof(struct xfs_fsop_geom_v1) == (112)': XFS: sizeof(struct xfs_fsop_geom_v1) is wrong, expected 112
     302 |         XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v1,                  112);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ondisk.h:10:16: note: expanded from macro 'XFS_CHECK_STRUCT_SIZE'
      10 |         static_assert(sizeof(structname) == (size), \
         |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      11 |                 "XFS: sizeof(" #structname ") is wrong, expected " #size)
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
      77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
         |                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   fs/xfs/libxfs/xfs_ondisk.h:302:2: note: expression evaluates to '108 == 112'
     302 |         XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v1,                  112);
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_ondisk.h:10:35: note: expanded from macro 'XFS_CHECK_STRUCT_SIZE'
      10 |         static_assert(sizeof(structname) == (size), \
         |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
      11 |                 "XFS: sizeof(" #structname ") is wrong, expected " #size)
         |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
      77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
         |                                  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
      78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
         |                                                        ^~~~
   1 error generated.


vim +302 fs/xfs/libxfs/xfs_ondisk.h

     8	
     9	#define XFS_CHECK_STRUCT_SIZE(structname, size) \
    10		static_assert(sizeof(structname) == (size), \
    11			"XFS: sizeof(" #structname ") is wrong, expected " #size)
    12	
    13	#define XFS_CHECK_OFFSET(structname, member, off) \
    14		static_assert(offsetof(structname, member) == (off), \
    15			"XFS: offsetof(" #structname ", " #member ") is wrong, " \
    16			"expected " #off)
    17	
    18	#define XFS_CHECK_VALUE(value, expected) \
    19		static_assert((value) == (expected), \
    20			"XFS: value of " #value " is wrong, expected " #expected)
    21	
    22	#define XFS_CHECK_SB_OFFSET(field, offset) \
    23		XFS_CHECK_OFFSET(struct xfs_dsb, field, offset); \
    24		XFS_CHECK_OFFSET(struct xfs_sb, field, offset);
    25	
    26	static inline void __init
    27	xfs_check_ondisk_structs(void)
    28	{
    29		/* ag/file structures */
    30		XFS_CHECK_STRUCT_SIZE(struct xfs_acl,			4);
    31		XFS_CHECK_STRUCT_SIZE(struct xfs_acl_entry,		12);
    32		XFS_CHECK_STRUCT_SIZE(struct xfs_agf,			224);
    33		XFS_CHECK_STRUCT_SIZE(struct xfs_agfl,			36);
    34		XFS_CHECK_STRUCT_SIZE(struct xfs_agi,			344);
    35		XFS_CHECK_STRUCT_SIZE(struct xfs_bmbt_key,		8);
    36		XFS_CHECK_STRUCT_SIZE(struct xfs_bmbt_rec,		16);
    37		XFS_CHECK_STRUCT_SIZE(struct xfs_bmdr_block,		4);
    38		XFS_CHECK_STRUCT_SIZE(struct xfs_btree_block_shdr,	48);
    39		XFS_CHECK_STRUCT_SIZE(struct xfs_btree_block_lhdr,	64);
    40		XFS_CHECK_STRUCT_SIZE(struct xfs_btree_block,		72);
    41		XFS_CHECK_STRUCT_SIZE(struct xfs_dinode,		176);
    42		XFS_CHECK_STRUCT_SIZE(struct xfs_disk_dquot,		104);
    43		XFS_CHECK_STRUCT_SIZE(struct xfs_dqblk,			136);
    44		XFS_CHECK_STRUCT_SIZE(struct xfs_dsb,			264);
    45		XFS_CHECK_STRUCT_SIZE(struct xfs_dsymlink_hdr,		56);
    46		XFS_CHECK_STRUCT_SIZE(struct xfs_inobt_key,		4);
    47		XFS_CHECK_STRUCT_SIZE(struct xfs_inobt_rec,		16);
    48		XFS_CHECK_STRUCT_SIZE(struct xfs_refcount_key,		4);
    49		XFS_CHECK_STRUCT_SIZE(struct xfs_refcount_rec,		12);
    50		XFS_CHECK_STRUCT_SIZE(struct xfs_rmap_key,		20);
    51		XFS_CHECK_STRUCT_SIZE(struct xfs_rmap_rec,		24);
    52		XFS_CHECK_STRUCT_SIZE(xfs_timestamp_t,			8);
    53		XFS_CHECK_STRUCT_SIZE(struct xfs_legacy_timestamp,	8);
    54		XFS_CHECK_STRUCT_SIZE(xfs_alloc_key_t,			8);
    55		XFS_CHECK_STRUCT_SIZE(xfs_alloc_ptr_t,			4);
    56		XFS_CHECK_STRUCT_SIZE(xfs_alloc_rec_t,			8);
    57		XFS_CHECK_STRUCT_SIZE(xfs_inobt_ptr_t,			4);
    58		XFS_CHECK_STRUCT_SIZE(xfs_refcount_ptr_t,		4);
    59		XFS_CHECK_STRUCT_SIZE(xfs_rmap_ptr_t,			4);
    60	
    61		/* dir/attr trees */
    62		XFS_CHECK_STRUCT_SIZE(struct xfs_attr3_leaf_hdr,	80);
    63		XFS_CHECK_STRUCT_SIZE(struct xfs_attr3_leafblock,	80);
    64		XFS_CHECK_STRUCT_SIZE(struct xfs_attr3_rmt_hdr,		56);
    65		XFS_CHECK_STRUCT_SIZE(struct xfs_da3_blkinfo,		56);
    66		XFS_CHECK_STRUCT_SIZE(struct xfs_da3_intnode,		64);
    67		XFS_CHECK_STRUCT_SIZE(struct xfs_da3_node_hdr,		64);
    68		XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_blk_hdr,		48);
    69		XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_data_hdr,		64);
    70		XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_free,		64);
    71		XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_free_hdr,		64);
    72		XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_leaf,		64);
    73		XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_leaf_hdr,		64);
    74		XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_entry_t,		8);
    75		XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_hdr_t,		32);
    76		XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_map_t,		4);
    77		XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_name_local_t,	4);
    78	
    79		/* realtime structures */
    80		XFS_CHECK_STRUCT_SIZE(union xfs_rtword_raw,		4);
    81		XFS_CHECK_STRUCT_SIZE(union xfs_suminfo_raw,		4);
    82	
    83		/*
    84		 * m68k has problems with xfs_attr_leaf_name_remote_t, but we pad it to
    85		 * 4 bytes anyway so it's not obviously a problem.  Hence for the moment
    86		 * we don't check this structure. This can be re-instated when the attr
    87		 * definitions are updated to use c99 VLA definitions.
    88		 *
    89		XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_name_remote_t,	12);
    90		 */
    91	
    92		XFS_CHECK_OFFSET(xfs_attr_leaf_name_local_t, valuelen,	0);
    93		XFS_CHECK_OFFSET(xfs_attr_leaf_name_local_t, namelen,	2);
    94		XFS_CHECK_OFFSET(xfs_attr_leaf_name_local_t, nameval,	3);
    95		XFS_CHECK_OFFSET(xfs_attr_leaf_name_remote_t, valueblk,	0);
    96		XFS_CHECK_OFFSET(xfs_attr_leaf_name_remote_t, valuelen,	4);
    97		XFS_CHECK_OFFSET(xfs_attr_leaf_name_remote_t, namelen,	8);
    98		XFS_CHECK_OFFSET(xfs_attr_leaf_name_remote_t, name,	9);
    99		XFS_CHECK_STRUCT_SIZE(xfs_attr_leafblock_t,		32);
   100		XFS_CHECK_STRUCT_SIZE(struct xfs_attr_sf_hdr,		4);
   101		XFS_CHECK_OFFSET(struct xfs_attr_sf_hdr, totsize,	0);
   102		XFS_CHECK_OFFSET(struct xfs_attr_sf_hdr, count,		2);
   103		XFS_CHECK_OFFSET(struct xfs_attr_sf_entry, namelen,	0);
   104		XFS_CHECK_OFFSET(struct xfs_attr_sf_entry, valuelen,	1);
   105		XFS_CHECK_OFFSET(struct xfs_attr_sf_entry, flags,	2);
   106		XFS_CHECK_OFFSET(struct xfs_attr_sf_entry, nameval,	3);
   107		XFS_CHECK_STRUCT_SIZE(xfs_da_blkinfo_t,			12);
   108		XFS_CHECK_STRUCT_SIZE(xfs_da_intnode_t,			16);
   109		XFS_CHECK_STRUCT_SIZE(xfs_da_node_entry_t,		8);
   110		XFS_CHECK_STRUCT_SIZE(xfs_da_node_hdr_t,		16);
   111		XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_free_t,		4);
   112		XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_hdr_t,		16);
   113		XFS_CHECK_OFFSET(xfs_dir2_data_unused_t, freetag,	0);
   114		XFS_CHECK_OFFSET(xfs_dir2_data_unused_t, length,	2);
   115		XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_hdr_t,		16);
   116		XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_t,			16);
   117		XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_entry_t,		8);
   118		XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_hdr_t,		16);
   119		XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_t,			16);
   120		XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_tail_t,		4);
   121		XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_entry_t,		3);
   122		XFS_CHECK_OFFSET(xfs_dir2_sf_entry_t, namelen,		0);
   123		XFS_CHECK_OFFSET(xfs_dir2_sf_entry_t, offset,		1);
   124		XFS_CHECK_OFFSET(xfs_dir2_sf_entry_t, name,		3);
   125		XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_hdr_t,		10);
   126		XFS_CHECK_STRUCT_SIZE(struct xfs_parent_rec,		12);
   127	
   128		/* log structures */
   129		XFS_CHECK_STRUCT_SIZE(struct xfs_buf_log_format,	88);
   130		XFS_CHECK_STRUCT_SIZE(struct xfs_dq_logformat,		24);
   131		XFS_CHECK_STRUCT_SIZE(struct xfs_efd_log_format_32,	16);
   132		XFS_CHECK_STRUCT_SIZE(struct xfs_efd_log_format_64,	16);
   133		XFS_CHECK_STRUCT_SIZE(struct xfs_efi_log_format_32,	16);
   134		XFS_CHECK_STRUCT_SIZE(struct xfs_efi_log_format_64,	16);
   135		XFS_CHECK_STRUCT_SIZE(struct xfs_extent_32,		12);
   136		XFS_CHECK_STRUCT_SIZE(struct xfs_extent_64,		16);
   137		XFS_CHECK_STRUCT_SIZE(struct xfs_log_dinode,		176);
   138		XFS_CHECK_STRUCT_SIZE(struct xfs_icreate_log,		28);
   139		XFS_CHECK_STRUCT_SIZE(xfs_log_timestamp_t,		8);
   140		XFS_CHECK_STRUCT_SIZE(struct xfs_log_legacy_timestamp,	8);
   141		XFS_CHECK_STRUCT_SIZE(struct xfs_inode_log_format_32,	52);
   142		XFS_CHECK_STRUCT_SIZE(struct xfs_inode_log_format,	56);
   143		XFS_CHECK_STRUCT_SIZE(struct xfs_qoff_logformat,	20);
   144		XFS_CHECK_STRUCT_SIZE(struct xfs_trans_header,		16);
   145		XFS_CHECK_STRUCT_SIZE(struct xfs_attri_log_format,	40);
   146		XFS_CHECK_STRUCT_SIZE(struct xfs_attrd_log_format,	16);
   147		XFS_CHECK_STRUCT_SIZE(struct xfs_bui_log_format,	16);
   148		XFS_CHECK_STRUCT_SIZE(struct xfs_bud_log_format,	16);
   149		XFS_CHECK_STRUCT_SIZE(struct xfs_cui_log_format,	16);
   150		XFS_CHECK_STRUCT_SIZE(struct xfs_cud_log_format,	16);
   151		XFS_CHECK_STRUCT_SIZE(struct xfs_rui_log_format,	16);
   152		XFS_CHECK_STRUCT_SIZE(struct xfs_rud_log_format,	16);
   153		XFS_CHECK_STRUCT_SIZE(struct xfs_map_extent,		32);
   154		XFS_CHECK_STRUCT_SIZE(struct xfs_phys_extent,		16);
   155	
   156		XFS_CHECK_OFFSET(struct xfs_bui_log_format, bui_extents,	16);
   157		XFS_CHECK_OFFSET(struct xfs_cui_log_format, cui_extents,	16);
   158		XFS_CHECK_OFFSET(struct xfs_rui_log_format, rui_extents,	16);
   159		XFS_CHECK_OFFSET(struct xfs_efi_log_format, efi_extents,	16);
   160		XFS_CHECK_OFFSET(struct xfs_efi_log_format_32, efi_extents,	16);
   161		XFS_CHECK_OFFSET(struct xfs_efi_log_format_64, efi_extents,	16);
   162	
   163		/* parent pointer ioctls */
   164		XFS_CHECK_STRUCT_SIZE(struct xfs_getparents_rec,	32);
   165		XFS_CHECK_STRUCT_SIZE(struct xfs_getparents,		40);
   166		XFS_CHECK_STRUCT_SIZE(struct xfs_getparents_by_handle,	64);
   167	
   168		/*
   169		 * The v5 superblock format extended several v4 header structures with
   170		 * additional data. While new fields are only accessible on v5
   171		 * superblocks, it's important that the v5 structures place original v4
   172		 * fields/headers in the correct location on-disk. For example, we must
   173		 * be able to find magic values at the same location in certain blocks
   174		 * regardless of superblock version.
   175		 *
   176		 * The following checks ensure that various v5 data structures place the
   177		 * subset of v4 metadata associated with the same type of block at the
   178		 * start of the on-disk block. If there is no data structure definition
   179		 * for certain types of v4 blocks, traverse down to the first field of
   180		 * common metadata (e.g., magic value) and make sure it is at offset
   181		 * zero.
   182		 */
   183		XFS_CHECK_OFFSET(struct xfs_dir3_leaf, hdr.info.hdr,	0);
   184		XFS_CHECK_OFFSET(struct xfs_da3_intnode, hdr.info.hdr,	0);
   185		XFS_CHECK_OFFSET(struct xfs_dir3_data_hdr, hdr.magic,	0);
   186		XFS_CHECK_OFFSET(struct xfs_dir3_free, hdr.hdr.magic,	0);
   187		XFS_CHECK_OFFSET(struct xfs_attr3_leafblock, hdr.info.hdr, 0);
   188	
   189		XFS_CHECK_STRUCT_SIZE(struct xfs_bulkstat,		192);
   190		XFS_CHECK_STRUCT_SIZE(struct xfs_inumbers,		24);
   191		XFS_CHECK_STRUCT_SIZE(struct xfs_bulkstat_req,		64);
   192		XFS_CHECK_STRUCT_SIZE(struct xfs_inumbers_req,		64);
   193	
   194		/*
   195		 * Make sure the incore inode timestamp range corresponds to hand
   196		 * converted values based on the ondisk format specification.
   197		 */
   198		XFS_CHECK_VALUE(XFS_BIGTIME_TIME_MIN - XFS_BIGTIME_EPOCH_OFFSET,
   199				XFS_LEGACY_TIME_MIN);
   200		XFS_CHECK_VALUE(XFS_BIGTIME_TIME_MAX - XFS_BIGTIME_EPOCH_OFFSET,
   201				16299260424LL);
   202	
   203		/* Do the same with the incore quota expiration range. */
   204		XFS_CHECK_VALUE(XFS_DQ_BIGTIME_EXPIRY_MIN << XFS_DQ_BIGTIME_SHIFT, 4);
   205		XFS_CHECK_VALUE(XFS_DQ_BIGTIME_EXPIRY_MAX << XFS_DQ_BIGTIME_SHIFT,
   206				16299260424LL);
   207	
   208		/* stuff we got from xfs/122 */
   209		XFS_CHECK_SB_OFFSET(sb_agblklog,		124);
   210		XFS_CHECK_SB_OFFSET(sb_agblocks,		84);
   211		XFS_CHECK_SB_OFFSET(sb_agcount,			88);
   212		XFS_CHECK_SB_OFFSET(sb_bad_features2,		204);
   213		XFS_CHECK_SB_OFFSET(sb_blocklog,		120);
   214		XFS_CHECK_SB_OFFSET(sb_blocksize,		4);
   215		XFS_CHECK_SB_OFFSET(sb_crc,			224);
   216		XFS_CHECK_SB_OFFSET(sb_dblocks,			8);
   217		XFS_CHECK_SB_OFFSET(sb_dirblklog,		192);
   218		XFS_CHECK_SB_OFFSET(sb_fdblocks,		144);
   219		XFS_CHECK_SB_OFFSET(sb_features2,		200);
   220		XFS_CHECK_SB_OFFSET(sb_features_compat,		208);
   221		XFS_CHECK_SB_OFFSET(sb_features_incompat,	216);
   222		XFS_CHECK_SB_OFFSET(sb_features_log_incompat,	220);
   223		XFS_CHECK_SB_OFFSET(sb_features_ro_compat,	212);
   224		XFS_CHECK_SB_OFFSET(sb_flags,			178);
   225		XFS_CHECK_SB_OFFSET(sb_fname[12],		120);
   226		XFS_CHECK_SB_OFFSET(sb_frextents,		152);
   227		XFS_CHECK_SB_OFFSET(sb_gquotino,		168);
   228		XFS_CHECK_SB_OFFSET(sb_icount,			128);
   229		XFS_CHECK_SB_OFFSET(sb_ifree,			136);
   230		XFS_CHECK_SB_OFFSET(sb_imax_pct,		127);
   231		XFS_CHECK_SB_OFFSET(sb_inoalignmt,		180);
   232		XFS_CHECK_SB_OFFSET(sb_inodelog,		122);
   233		XFS_CHECK_SB_OFFSET(sb_inodesize,		104);
   234		XFS_CHECK_SB_OFFSET(sb_inopblock,		106);
   235		XFS_CHECK_SB_OFFSET(sb_inopblog,		123);
   236		XFS_CHECK_SB_OFFSET(sb_inprogress,		126);
   237		XFS_CHECK_SB_OFFSET(sb_logblocks,		96);
   238		XFS_CHECK_SB_OFFSET(sb_logsectlog,		193);
   239		XFS_CHECK_SB_OFFSET(sb_logsectsize,		194);
   240		XFS_CHECK_SB_OFFSET(sb_logstart,		48);
   241		XFS_CHECK_SB_OFFSET(sb_logsunit,		196);
   242		XFS_CHECK_SB_OFFSET(sb_lsn,			240);
   243		XFS_CHECK_SB_OFFSET(sb_magicnum,		0);
   244		XFS_CHECK_SB_OFFSET(sb_meta_uuid,		248);
   245		XFS_CHECK_SB_OFFSET(sb_pquotino,		232);
   246		XFS_CHECK_SB_OFFSET(sb_qflags,			176);
   247		XFS_CHECK_SB_OFFSET(sb_rblocks,			16);
   248		XFS_CHECK_SB_OFFSET(sb_rbmblocks,		92);
   249		XFS_CHECK_SB_OFFSET(sb_rbmino,			64);
   250		XFS_CHECK_SB_OFFSET(sb_rextents,		24);
   251		XFS_CHECK_SB_OFFSET(sb_rextsize,		80);
   252		XFS_CHECK_SB_OFFSET(sb_rextslog,		125);
   253		XFS_CHECK_SB_OFFSET(sb_rootino,			56);
   254		XFS_CHECK_SB_OFFSET(sb_rsumino,			72);
   255		XFS_CHECK_SB_OFFSET(sb_sectlog,			121);
   256		XFS_CHECK_SB_OFFSET(sb_sectsize,		102);
   257		XFS_CHECK_SB_OFFSET(sb_shared_vn,		179);
   258		XFS_CHECK_SB_OFFSET(sb_spino_align,		228);
   259		XFS_CHECK_SB_OFFSET(sb_unit,			184);
   260		XFS_CHECK_SB_OFFSET(sb_uquotino,		160);
   261		XFS_CHECK_SB_OFFSET(sb_uuid,			32);
   262		XFS_CHECK_SB_OFFSET(sb_versionnum,		100);
   263		XFS_CHECK_SB_OFFSET(sb_width,			188);
   264	
   265		XFS_CHECK_STRUCT_SIZE(struct xfs_ag_geometry,			128);
   266		XFS_CHECK_STRUCT_SIZE(struct xfs_alloc_rec,			8);
   267		XFS_CHECK_STRUCT_SIZE(struct xfs_alloc_rec_incore,		8);
   268		XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_entry,		8);
   269		XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_hdr,			32);
   270		XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_map,			4);
   271		XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_name_local,		4);
   272		XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_name_remote,		12);
   273		XFS_CHECK_STRUCT_SIZE(struct xfs_attrlist_cursor,		16);
   274		XFS_CHECK_STRUCT_SIZE(struct xfs_attr_sf_entry,			3);
   275		XFS_CHECK_STRUCT_SIZE(xfs_bmdr_key_t,				8);
   276		XFS_CHECK_STRUCT_SIZE(struct xfs_bulk_ireq,			64);
   277		XFS_CHECK_STRUCT_SIZE(struct xfs_commit_range,			88);
   278		XFS_CHECK_STRUCT_SIZE(struct xfs_da_blkinfo,			12);
   279		XFS_CHECK_STRUCT_SIZE(struct xfs_da_intnode,			16);
   280		XFS_CHECK_STRUCT_SIZE(struct xfs_da_node_entry,			8);
   281		XFS_CHECK_STRUCT_SIZE(struct xfs_da_node_hdr,			16);
   282		XFS_CHECK_STRUCT_SIZE(enum xfs_dinode_fmt,			4);
   283		XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_data_free,		4);
   284		XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_data_hdr,			16);
   285		XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_data_unused,		6);
   286		XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_free,			16);
   287		XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_free_hdr,			16);
   288		XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf,			16);
   289		XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf_entry,		8);
   290		XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf_hdr,			16);
   291		XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf_tail,		4);
   292		XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_sf_entry,			3);
   293		XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_sf_hdr,			10);
   294		XFS_CHECK_STRUCT_SIZE(struct xfs_error_injection,		8);
   295		XFS_CHECK_STRUCT_SIZE(struct xfs_exchange_range,		40);
   296		XFS_CHECK_STRUCT_SIZE(xfs_exntst_t,				4);
   297		XFS_CHECK_STRUCT_SIZE(struct xfs_fid,				16);
   298		XFS_CHECK_STRUCT_SIZE(struct xfs_fs_eofblocks,			128);
   299		XFS_CHECK_STRUCT_SIZE(struct xfs_fsid,				8);
   300		XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_counts,			32);
   301		XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom,			256);
 > 302		XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v1,			112);
   303		XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v4,			112);
   304		XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_resblks,			16);
   305		XFS_CHECK_STRUCT_SIZE(struct xfs_growfs_log,			8);
   306		XFS_CHECK_STRUCT_SIZE(struct xfs_handle,			24);
   307		XFS_CHECK_STRUCT_SIZE(struct xfs_scrub_metadata,		64);
   308		XFS_CHECK_STRUCT_SIZE(struct xfs_scrub_vec,			16);
   309		XFS_CHECK_STRUCT_SIZE(struct xfs_scrub_vec_head,		40);
   310		XFS_CHECK_STRUCT_SIZE(struct xfs_unmount_log_format,		8);
   311		XFS_CHECK_STRUCT_SIZE(struct xfs_xmd_log_format,		16);
   312		XFS_CHECK_STRUCT_SIZE(struct xfs_xmi_log_format,		88);
   313	}
   314
Christoph Hellwig Oct. 15, 2024, 5:09 a.m. UTC | #5
On Mon, Oct 14, 2024 at 08:25:33AM -0700, Darrick J. Wong wrote:
> On Sun, Oct 13, 2024 at 11:03:55PM -0700, Christoph Hellwig wrote:
> > On Fri, Oct 11, 2024 at 11:24:07AM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > Check this with every kernel and userspace build, so we can drop the
> > > nonsense in xfs/122.  Roughly drafted with:
> > 
> > Is ondisk.h the right file for checks on ioctl structures?  Otherwise
> > looks good.
> 
> Dunno -- maybe those should go in xfs_fs.h, but I'm hesitant to ship
> that kind of noise to every customer. :)

Yeah.  Maybe just rename xfs_ondisk.h to xfs_size_check.h?
Dave Chinner Oct. 15, 2024, 9:09 a.m. UTC | #6
On Fri, Oct 11, 2024 at 11:24:07AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Check this with every kernel and userspace build, so we can drop the
> nonsense in xfs/122.  Roughly drafted with:
> 
> sed -e 's/^offsetof/\tXFS_CHECK_OFFSET/g' \
> 	-e 's/^sizeof/\tXFS_CHECK_STRUCT_SIZE/g' \
> 	-e 's/ = \([0-9]*\)/,\t\t\t\1);/g' \
> 	-e 's/xfs_sb_t/struct xfs_dsb/g' \
> 	-e 's/),/,/g' \
> 	-e 's/xfs_\([a-z0-9_]*\)_t,/struct xfs_\1,/g' \
> 	< tests/xfs/122.out | sort
> 
> and then manual fixups.

[snip on disk structures]

I don't think we can type check all these ioctl structures,
especially the old ones.

i.e. The old ioctl structures are not padded to 64 bit boundaries,
nor are they constructed without internal padding holes, and this is
why compat ioctls exist. Hence any ioctl structure that has a compat
definition in xfs_ioctl32.h can't be size checked like this....

> +	XFS_CHECK_STRUCT_SIZE(struct xfs_error_injection,		8);
> +	XFS_CHECK_STRUCT_SIZE(struct xfs_exchange_range,		40);
> +	XFS_CHECK_STRUCT_SIZE(xfs_exntst_t,				4);
> +	XFS_CHECK_STRUCT_SIZE(struct xfs_fid,				16);
> +	XFS_CHECK_STRUCT_SIZE(struct xfs_fs_eofblocks,			128);
> +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsid,				8);
> +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_counts,			32);
> +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom,			256);
> +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v1,			112);

e.g. xfs_fsop_geom_v1 is 108 bytes on 32 bit systems, not 112:

struct compat_xfs_fsop_geom_v1 {
        __u32                      blocksize;            /*     0     4 */
        __u32                      rtextsize;            /*     4     4 */
        __u32                      agblocks;             /*     8     4 */
        __u32                      agcount;              /*    12     4 */
        __u32                      logblocks;            /*    16     4 */
        __u32                      sectsize;             /*    20     4 */
        __u32                      inodesize;            /*    24     4 */
        __u32                      imaxpct;              /*    28     4 */
        __u64                      datablocks;           /*    32     8 */
        __u64                      rtblocks;             /*    40     8 */
        __u64                      rtextents;            /*    48     8 */
        __u64                      logstart;             /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        unsigned char              uuid[16];             /*    64    16 */
        __u32                      sunit;                /*    80     4 */
        __u32                      swidth;               /*    84     4 */
        __s32                      version;              /*    88     4 */
        __u32                      flags;                /*    92     4 */
        __u32                      logsectsize;          /*    96     4 */
        __u32                      rtsectsize;           /*   100     4 */
        __u32                      dirblocksize;         /*   104     4 */

        /* size: 108, cachelines: 2, members: 20 */
        /* last cacheline: 44 bytes */
} __attribute__((__packed__));

I'm not sure we need to size check these structures - if they change
size, the ioctl number will change and that means all the userspace
test code built against the system /usr/include/xfs/xfs_fs.h file
that exercises the ioctls will stop working, right? i.e. breakage
should be pretty obvious...

-Dave.
Darrick J. Wong Oct. 15, 2024, 4:59 p.m. UTC | #7
On Tue, Oct 15, 2024 at 08:09:53PM +1100, Dave Chinner wrote:
> On Fri, Oct 11, 2024 at 11:24:07AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Check this with every kernel and userspace build, so we can drop the
> > nonsense in xfs/122.  Roughly drafted with:
> > 
> > sed -e 's/^offsetof/\tXFS_CHECK_OFFSET/g' \
> > 	-e 's/^sizeof/\tXFS_CHECK_STRUCT_SIZE/g' \
> > 	-e 's/ = \([0-9]*\)/,\t\t\t\1);/g' \
> > 	-e 's/xfs_sb_t/struct xfs_dsb/g' \
> > 	-e 's/),/,/g' \
> > 	-e 's/xfs_\([a-z0-9_]*\)_t,/struct xfs_\1,/g' \
> > 	< tests/xfs/122.out | sort
> > 
> > and then manual fixups.
> 
> [snip on disk structures]
> 
> I don't think we can type check all these ioctl structures,
> especially the old ones.
> 
> i.e. The old ioctl structures are not padded to 64 bit boundaries,
> nor are they constructed without internal padding holes, and this is
> why compat ioctls exist. Hence any ioctl structure that has a compat
> definition in xfs_ioctl32.h can't be size checked like this....
> 
> > +	XFS_CHECK_STRUCT_SIZE(struct xfs_error_injection,		8);
> > +	XFS_CHECK_STRUCT_SIZE(struct xfs_exchange_range,		40);
> > +	XFS_CHECK_STRUCT_SIZE(xfs_exntst_t,				4);
> > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fid,				16);
> > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fs_eofblocks,			128);
> > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsid,				8);
> > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_counts,			32);
> > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom,			256);
> > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v1,			112);
> 
> e.g. xfs_fsop_geom_v1 is 108 bytes on 32 bit systems, not 112:
> 
> struct compat_xfs_fsop_geom_v1 {
>         __u32                      blocksize;            /*     0     4 */
>         __u32                      rtextsize;            /*     4     4 */
>         __u32                      agblocks;             /*     8     4 */
>         __u32                      agcount;              /*    12     4 */
>         __u32                      logblocks;            /*    16     4 */
>         __u32                      sectsize;             /*    20     4 */
>         __u32                      inodesize;            /*    24     4 */
>         __u32                      imaxpct;              /*    28     4 */
>         __u64                      datablocks;           /*    32     8 */
>         __u64                      rtblocks;             /*    40     8 */
>         __u64                      rtextents;            /*    48     8 */
>         __u64                      logstart;             /*    56     8 */
>         /* --- cacheline 1 boundary (64 bytes) --- */
>         unsigned char              uuid[16];             /*    64    16 */
>         __u32                      sunit;                /*    80     4 */
>         __u32                      swidth;               /*    84     4 */
>         __s32                      version;              /*    88     4 */
>         __u32                      flags;                /*    92     4 */
>         __u32                      logsectsize;          /*    96     4 */
>         __u32                      rtsectsize;           /*   100     4 */
>         __u32                      dirblocksize;         /*   104     4 */
> 
>         /* size: 108, cachelines: 2, members: 20 */
>         /* last cacheline: 44 bytes */
> } __attribute__((__packed__));
> 
> I'm not sure we need to size check these structures - if they change
> size, the ioctl number will change and that means all the userspace
> test code built against the system /usr/include/xfs/xfs_fs.h file
> that exercises the ioctls will stop working, right? i.e. breakage
> should be pretty obvious...

It should, though I worry about the case where we accidentally change
the size on some weird architecture, some distro ships a new release
with everything built against the broken headers, and only later does
someone notice that their old program now starts failing.

I guess the question is, do we hardcode the known sizes here, e.g.

	XFS_CHECK_IOCTL_SIZE(struct xfs_fsop_geom_v1, 108, 112);

wherein we'd assert that sizeof() == 108 || sizeof() == 112?

Or not care if things happen to the ioctls?  Part of aim of this posting
was to trick the build bots into revealing which architectures break on
the compat ioctl stuff... ;)

--D

> -Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
>
Darrick J. Wong Oct. 15, 2024, 5:08 p.m. UTC | #8
On Mon, Oct 14, 2024 at 10:09:42PM -0700, Christoph Hellwig wrote:
> On Mon, Oct 14, 2024 at 08:25:33AM -0700, Darrick J. Wong wrote:
> > On Sun, Oct 13, 2024 at 11:03:55PM -0700, Christoph Hellwig wrote:
> > > On Fri, Oct 11, 2024 at 11:24:07AM -0700, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > 
> > > > Check this with every kernel and userspace build, so we can drop the
> > > > nonsense in xfs/122.  Roughly drafted with:
> > > 
> > > Is ondisk.h the right file for checks on ioctl structures?  Otherwise
> > > looks good.
> > 
> > Dunno -- maybe those should go in xfs_fs.h, but I'm hesitant to ship
> > that kind of noise to every customer. :)
> 
> Yeah.  Maybe just rename xfs_ondisk.h to xfs_size_check.h?

Sounds good to me.

--D
Dave Chinner Oct. 15, 2024, 10:01 p.m. UTC | #9
On Tue, Oct 15, 2024 at 09:59:21AM -0700, Darrick J. Wong wrote:
> On Tue, Oct 15, 2024 at 08:09:53PM +1100, Dave Chinner wrote:
> > On Fri, Oct 11, 2024 at 11:24:07AM -0700, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > Check this with every kernel and userspace build, so we can drop the
> > > nonsense in xfs/122.  Roughly drafted with:
> > > 
> > > sed -e 's/^offsetof/\tXFS_CHECK_OFFSET/g' \
> > > 	-e 's/^sizeof/\tXFS_CHECK_STRUCT_SIZE/g' \
> > > 	-e 's/ = \([0-9]*\)/,\t\t\t\1);/g' \
> > > 	-e 's/xfs_sb_t/struct xfs_dsb/g' \
> > > 	-e 's/),/,/g' \
> > > 	-e 's/xfs_\([a-z0-9_]*\)_t,/struct xfs_\1,/g' \
> > > 	< tests/xfs/122.out | sort
> > > 
> > > and then manual fixups.
> > 
> > [snip on disk structures]
> > 
> > I don't think we can type check all these ioctl structures,
> > especially the old ones.
> > 
> > i.e. The old ioctl structures are not padded to 64 bit boundaries,
> > nor are they constructed without internal padding holes, and this is
> > why compat ioctls exist. Hence any ioctl structure that has a compat
> > definition in xfs_ioctl32.h can't be size checked like this....
> > 
> > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_error_injection,		8);
> > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_exchange_range,		40);
> > > +	XFS_CHECK_STRUCT_SIZE(xfs_exntst_t,				4);
> > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fid,				16);
> > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fs_eofblocks,			128);
> > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsid,				8);
> > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_counts,			32);
> > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom,			256);
> > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v1,			112);
> > 
> > e.g. xfs_fsop_geom_v1 is 108 bytes on 32 bit systems, not 112:
> > 
> > struct compat_xfs_fsop_geom_v1 {
> >         __u32                      blocksize;            /*     0     4 */
> >         __u32                      rtextsize;            /*     4     4 */
> >         __u32                      agblocks;             /*     8     4 */
> >         __u32                      agcount;              /*    12     4 */
> >         __u32                      logblocks;            /*    16     4 */
> >         __u32                      sectsize;             /*    20     4 */
> >         __u32                      inodesize;            /*    24     4 */
> >         __u32                      imaxpct;              /*    28     4 */
> >         __u64                      datablocks;           /*    32     8 */
> >         __u64                      rtblocks;             /*    40     8 */
> >         __u64                      rtextents;            /*    48     8 */
> >         __u64                      logstart;             /*    56     8 */
> >         /* --- cacheline 1 boundary (64 bytes) --- */
> >         unsigned char              uuid[16];             /*    64    16 */
> >         __u32                      sunit;                /*    80     4 */
> >         __u32                      swidth;               /*    84     4 */
> >         __s32                      version;              /*    88     4 */
> >         __u32                      flags;                /*    92     4 */
> >         __u32                      logsectsize;          /*    96     4 */
> >         __u32                      rtsectsize;           /*   100     4 */
> >         __u32                      dirblocksize;         /*   104     4 */
> > 
> >         /* size: 108, cachelines: 2, members: 20 */
> >         /* last cacheline: 44 bytes */
> > } __attribute__((__packed__));
> > 
> > I'm not sure we need to size check these structures - if they change
> > size, the ioctl number will change and that means all the userspace
> > test code built against the system /usr/include/xfs/xfs_fs.h file
> > that exercises the ioctls will stop working, right? i.e. breakage
> > should be pretty obvious...
> 
> It should, though I worry about the case where we accidentally change
> the size on some weird architecture, some distro ships a new release
> with everything built against the broken headers, and only later does
> someone notice that their old program now starts failing.
> 
> I guess the question is, do we hardcode the known sizes here, e.g.
> 
> 	XFS_CHECK_IOCTL_SIZE(struct xfs_fsop_geom_v1, 108, 112);
> 
> wherein we'd assert that sizeof() == 108 || sizeof() == 112?

This feels kinda fragile. We want the compiler to do the validation
work for both the normal and compat ioctl structures. Just
specifying two sizes doesn't actually do that.

i.e. this really needs to check that the structure size is the same
on all 64 bit platforms, the compat structure is the same on -all-
platforms (32 and 64 bit), and that the the structure size is the
same as the compat structure size on all 32 bit platforms....

> Or not care if things happen to the ioctls?  Part of aim of this posting
> was to trick the build bots into revealing which architectures break on
> the compat ioctl stuff... ;)

If that's your goal, then this needs to be validating the compat
structures are the correct size, too.

-Dave.
kernel test robot Oct. 16, 2024, 8:58 a.m. UTC | #10
Hi Darrick,

kernel test robot noticed the following build warnings:

[auto build test WARNING on xfs-linux/for-next]
[also build test WARNING on linus/master v6.12-rc3 next-20241014]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Darrick-J-Wong/xfs-port-xfs-122-to-the-kernel/20241012-022552
base:   https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git for-next
patch link:    https://lore.kernel.org/r/20241011182407.GC21853%40frogsfrogsfrogs
patch subject: [PATCH] xfs: port xfs/122 to the kernel
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: arm-randconfig-r132-20241015 (https://download.01.org/0day-ci/archive/20241015/202410151539.xVeElBsB-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 70e0a7e7e6a8541bcc46908c592eed561850e416)
reproduce: (https://download.01.org/0day-ci/archive/20241015/202410151539.xVeElBsB-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202410151539.xVeElBsB-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   fs/xfs/xfs_super.c: note: in included file:
>> fs/xfs/libxfs/xfs_ondisk.h:302:9: sparse: sparse: static assertion failed: "XFS: sizeof(struct xfs_fsop_geom_v1) is wrong, expected 112"

vim +302 fs/xfs/libxfs/xfs_ondisk.h

30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09    8  
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09    9  #define XFS_CHECK_STRUCT_SIZE(structname, size) \
c12c50393c1f6f fs/xfs/xfs_ondisk.h        Christoph Hellwig 2023-12-04   10  	static_assert(sizeof(structname) == (size), \
c12c50393c1f6f fs/xfs/xfs_ondisk.h        Christoph Hellwig 2023-12-04   11  		"XFS: sizeof(" #structname ") is wrong, expected " #size)
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   12  
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21   13  #define XFS_CHECK_OFFSET(structname, member, off) \
c12c50393c1f6f fs/xfs/xfs_ondisk.h        Christoph Hellwig 2023-12-04   14  	static_assert(offsetof(structname, member) == (off), \
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21   15  		"XFS: offsetof(" #structname ", " #member ") is wrong, " \
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21   16  		"expected " #off)
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21   17  
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17   18  #define XFS_CHECK_VALUE(value, expected) \
c12c50393c1f6f fs/xfs/xfs_ondisk.h        Christoph Hellwig 2023-12-04   19  	static_assert((value) == (expected), \
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17   20  		"XFS: value of " #value " is wrong, expected " #expected)
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17   21  
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11   22  #define XFS_CHECK_SB_OFFSET(field, offset) \
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11   23  	XFS_CHECK_OFFSET(struct xfs_dsb, field, offset); \
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11   24  	XFS_CHECK_OFFSET(struct xfs_sb, field, offset);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11   25  
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   26  static inline void __init
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   27  xfs_check_ondisk_structs(void)
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   28  {
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   29  	/* ag/file structures */
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   30  	XFS_CHECK_STRUCT_SIZE(struct xfs_acl,			4);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   31  	XFS_CHECK_STRUCT_SIZE(struct xfs_acl_entry,		12);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   32  	XFS_CHECK_STRUCT_SIZE(struct xfs_agf,			224);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   33  	XFS_CHECK_STRUCT_SIZE(struct xfs_agfl,			36);
2a39946c984464 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17   34  	XFS_CHECK_STRUCT_SIZE(struct xfs_agi,			344);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   35  	XFS_CHECK_STRUCT_SIZE(struct xfs_bmbt_key,		8);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   36  	XFS_CHECK_STRUCT_SIZE(struct xfs_bmbt_rec,		16);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   37  	XFS_CHECK_STRUCT_SIZE(struct xfs_bmdr_block,		4);
ad70328a503fae fs/xfs/xfs_ondisk.h        Hou Tao           2016-07-20   38  	XFS_CHECK_STRUCT_SIZE(struct xfs_btree_block_shdr,	48);
ad70328a503fae fs/xfs/xfs_ondisk.h        Hou Tao           2016-07-20   39  	XFS_CHECK_STRUCT_SIZE(struct xfs_btree_block_lhdr,	64);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   40  	XFS_CHECK_STRUCT_SIZE(struct xfs_btree_block,		72);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   41  	XFS_CHECK_STRUCT_SIZE(struct xfs_dinode,		176);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   42  	XFS_CHECK_STRUCT_SIZE(struct xfs_disk_dquot,		104);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   43  	XFS_CHECK_STRUCT_SIZE(struct xfs_dqblk,			136);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   44  	XFS_CHECK_STRUCT_SIZE(struct xfs_dsb,			264);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   45  	XFS_CHECK_STRUCT_SIZE(struct xfs_dsymlink_hdr,		56);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   46  	XFS_CHECK_STRUCT_SIZE(struct xfs_inobt_key,		4);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   47  	XFS_CHECK_STRUCT_SIZE(struct xfs_inobt_rec,		16);
1946b91cee4fc8 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-10-03   48  	XFS_CHECK_STRUCT_SIZE(struct xfs_refcount_key,		4);
1946b91cee4fc8 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-10-03   49  	XFS_CHECK_STRUCT_SIZE(struct xfs_refcount_rec,		12);
035e00acb5c719 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-08-03   50  	XFS_CHECK_STRUCT_SIZE(struct xfs_rmap_key,		20);
035e00acb5c719 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-08-03   51  	XFS_CHECK_STRUCT_SIZE(struct xfs_rmap_rec,		24);
5a0bb066f60fa0 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-24   52  	XFS_CHECK_STRUCT_SIZE(xfs_timestamp_t,			8);
5a0bb066f60fa0 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-24   53  	XFS_CHECK_STRUCT_SIZE(struct xfs_legacy_timestamp,	8);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   54  	XFS_CHECK_STRUCT_SIZE(xfs_alloc_key_t,			8);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   55  	XFS_CHECK_STRUCT_SIZE(xfs_alloc_ptr_t,			4);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   56  	XFS_CHECK_STRUCT_SIZE(xfs_alloc_rec_t,			8);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   57  	XFS_CHECK_STRUCT_SIZE(xfs_inobt_ptr_t,			4);
1946b91cee4fc8 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-10-03   58  	XFS_CHECK_STRUCT_SIZE(xfs_refcount_ptr_t,		4);
035e00acb5c719 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-08-03   59  	XFS_CHECK_STRUCT_SIZE(xfs_rmap_ptr_t,			4);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   60  
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   61  	/* dir/attr trees */
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   62  	XFS_CHECK_STRUCT_SIZE(struct xfs_attr3_leaf_hdr,	80);
a49bbce58ea90b fs/xfs/xfs_ondisk.h        Darrick J. Wong   2023-07-10   63  	XFS_CHECK_STRUCT_SIZE(struct xfs_attr3_leafblock,	80);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   64  	XFS_CHECK_STRUCT_SIZE(struct xfs_attr3_rmt_hdr,		56);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   65  	XFS_CHECK_STRUCT_SIZE(struct xfs_da3_blkinfo,		56);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   66  	XFS_CHECK_STRUCT_SIZE(struct xfs_da3_intnode,		64);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   67  	XFS_CHECK_STRUCT_SIZE(struct xfs_da3_node_hdr,		64);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   68  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_blk_hdr,		48);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   69  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_data_hdr,		64);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   70  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_free,		64);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   71  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_free_hdr,		64);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   72  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_leaf,		64);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   73  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir3_leaf_hdr,		64);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   74  	XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_entry_t,		8);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   75  	XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_hdr_t,		32);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   76  	XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_map_t,		4);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   77  	XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_name_local_t,	4);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   78  
97e993830a1cdd fs/xfs/xfs_ondisk.h        Darrick J. Wong   2023-10-16   79  	/* realtime structures */
97e993830a1cdd fs/xfs/xfs_ondisk.h        Darrick J. Wong   2023-10-16   80  	XFS_CHECK_STRUCT_SIZE(union xfs_rtword_raw,		4);
663b8db7b0256b fs/xfs/xfs_ondisk.h        Darrick J. Wong   2023-10-16   81  	XFS_CHECK_STRUCT_SIZE(union xfs_suminfo_raw,		4);
97e993830a1cdd fs/xfs/xfs_ondisk.h        Darrick J. Wong   2023-10-16   82  
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   83  	/*
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   84  	 * m68k has problems with xfs_attr_leaf_name_remote_t, but we pad it to
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   85  	 * 4 bytes anyway so it's not obviously a problem.  Hence for the moment
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   86  	 * we don't check this structure. This can be re-instated when the attr
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   87  	 * definitions are updated to use c99 VLA definitions.
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   88  	 *
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   89  	XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_name_remote_t,	12);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   90  	 */
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09   91  
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21   92  	XFS_CHECK_OFFSET(xfs_attr_leaf_name_local_t, valuelen,	0);
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21   93  	XFS_CHECK_OFFSET(xfs_attr_leaf_name_local_t, namelen,	2);
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21   94  	XFS_CHECK_OFFSET(xfs_attr_leaf_name_local_t, nameval,	3);
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21   95  	XFS_CHECK_OFFSET(xfs_attr_leaf_name_remote_t, valueblk,	0);
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21   96  	XFS_CHECK_OFFSET(xfs_attr_leaf_name_remote_t, valuelen,	4);
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21   97  	XFS_CHECK_OFFSET(xfs_attr_leaf_name_remote_t, namelen,	8);
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21   98  	XFS_CHECK_OFFSET(xfs_attr_leaf_name_remote_t, name,	9);
a49bbce58ea90b fs/xfs/xfs_ondisk.h        Darrick J. Wong   2023-07-10   99  	XFS_CHECK_STRUCT_SIZE(xfs_attr_leafblock_t,		32);
414147225400a0 fs/xfs/libxfs/xfs_ondisk.h Christoph Hellwig 2023-12-20  100  	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_sf_hdr,		4);
414147225400a0 fs/xfs/libxfs/xfs_ondisk.h Christoph Hellwig 2023-12-20  101  	XFS_CHECK_OFFSET(struct xfs_attr_sf_hdr, totsize,	0);
414147225400a0 fs/xfs/libxfs/xfs_ondisk.h Christoph Hellwig 2023-12-20  102  	XFS_CHECK_OFFSET(struct xfs_attr_sf_hdr, count,		2);
414147225400a0 fs/xfs/libxfs/xfs_ondisk.h Christoph Hellwig 2023-12-20  103  	XFS_CHECK_OFFSET(struct xfs_attr_sf_entry, namelen,	0);
414147225400a0 fs/xfs/libxfs/xfs_ondisk.h Christoph Hellwig 2023-12-20  104  	XFS_CHECK_OFFSET(struct xfs_attr_sf_entry, valuelen,	1);
414147225400a0 fs/xfs/libxfs/xfs_ondisk.h Christoph Hellwig 2023-12-20  105  	XFS_CHECK_OFFSET(struct xfs_attr_sf_entry, flags,	2);
414147225400a0 fs/xfs/libxfs/xfs_ondisk.h Christoph Hellwig 2023-12-20  106  	XFS_CHECK_OFFSET(struct xfs_attr_sf_entry, nameval,	3);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  107  	XFS_CHECK_STRUCT_SIZE(xfs_da_blkinfo_t,			12);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  108  	XFS_CHECK_STRUCT_SIZE(xfs_da_intnode_t,			16);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  109  	XFS_CHECK_STRUCT_SIZE(xfs_da_node_entry_t,		8);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  110  	XFS_CHECK_STRUCT_SIZE(xfs_da_node_hdr_t,		16);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  111  	XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_free_t,		4);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  112  	XFS_CHECK_STRUCT_SIZE(xfs_dir2_data_hdr_t,		16);
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21  113  	XFS_CHECK_OFFSET(xfs_dir2_data_unused_t, freetag,	0);
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21  114  	XFS_CHECK_OFFSET(xfs_dir2_data_unused_t, length,	2);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  115  	XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_hdr_t,		16);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  116  	XFS_CHECK_STRUCT_SIZE(xfs_dir2_free_t,			16);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  117  	XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_entry_t,		8);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  118  	XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_hdr_t,		16);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  119  	XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_t,			16);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  120  	XFS_CHECK_STRUCT_SIZE(xfs_dir2_leaf_tail_t,		4);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  121  	XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_entry_t,		3);
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21  122  	XFS_CHECK_OFFSET(xfs_dir2_sf_entry_t, namelen,		0);
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21  123  	XFS_CHECK_OFFSET(xfs_dir2_sf_entry_t, offset,		1);
3f94c441e2c3de fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-06-21  124  	XFS_CHECK_OFFSET(xfs_dir2_sf_entry_t, name,		3);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  125  	XFS_CHECK_STRUCT_SIZE(xfs_dir2_sf_hdr_t,		10);
8337d58ab2868f fs/xfs/libxfs/xfs_ondisk.h Allison Henderson 2024-04-22  126  	XFS_CHECK_STRUCT_SIZE(struct xfs_parent_rec,		12);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  127  
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  128  	/* log structures */
b7df5e92055c69 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-01-07  129  	XFS_CHECK_STRUCT_SIZE(struct xfs_buf_log_format,	88);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  130  	XFS_CHECK_STRUCT_SIZE(struct xfs_dq_logformat,		24);
03a7485cd701e1 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  131  	XFS_CHECK_STRUCT_SIZE(struct xfs_efd_log_format_32,	16);
03a7485cd701e1 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  132  	XFS_CHECK_STRUCT_SIZE(struct xfs_efd_log_format_64,	16);
03a7485cd701e1 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  133  	XFS_CHECK_STRUCT_SIZE(struct xfs_efi_log_format_32,	16);
03a7485cd701e1 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  134  	XFS_CHECK_STRUCT_SIZE(struct xfs_efi_log_format_64,	16);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  135  	XFS_CHECK_STRUCT_SIZE(struct xfs_extent_32,		12);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  136  	XFS_CHECK_STRUCT_SIZE(struct xfs_extent_64,		16);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  137  	XFS_CHECK_STRUCT_SIZE(struct xfs_log_dinode,		176);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  138  	XFS_CHECK_STRUCT_SIZE(struct xfs_icreate_log,		28);
6fc277c7c935c7 fs/xfs/xfs_ondisk.h        Christoph Hellwig 2021-04-21  139  	XFS_CHECK_STRUCT_SIZE(xfs_log_timestamp_t,		8);
732de7dbdbd30d fs/xfs/xfs_ondisk.h        Christoph Hellwig 2021-04-21  140  	XFS_CHECK_STRUCT_SIZE(struct xfs_log_legacy_timestamp,	8);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  141  	XFS_CHECK_STRUCT_SIZE(struct xfs_inode_log_format_32,	52);
20413e37d71bef fs/xfs/xfs_ondisk.h        Dave Chinner      2017-10-09  142  	XFS_CHECK_STRUCT_SIZE(struct xfs_inode_log_format,	56);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  143  	XFS_CHECK_STRUCT_SIZE(struct xfs_qoff_logformat,	20);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  144  	XFS_CHECK_STRUCT_SIZE(struct xfs_trans_header,		16);
fd920008784ead fs/xfs/xfs_ondisk.h        Allison Henderson 2022-05-04  145  	XFS_CHECK_STRUCT_SIZE(struct xfs_attri_log_format,	40);
fd920008784ead fs/xfs/xfs_ondisk.h        Allison Henderson 2022-05-04  146  	XFS_CHECK_STRUCT_SIZE(struct xfs_attrd_log_format,	16);
a38ebce1da271f fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  147  	XFS_CHECK_STRUCT_SIZE(struct xfs_bui_log_format,	16);
a38ebce1da271f fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  148  	XFS_CHECK_STRUCT_SIZE(struct xfs_bud_log_format,	16);
a38935c03c7914 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  149  	XFS_CHECK_STRUCT_SIZE(struct xfs_cui_log_format,	16);
a38935c03c7914 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  150  	XFS_CHECK_STRUCT_SIZE(struct xfs_cud_log_format,	16);
b45ca961e94673 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  151  	XFS_CHECK_STRUCT_SIZE(struct xfs_rui_log_format,	16);
b45ca961e94673 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  152  	XFS_CHECK_STRUCT_SIZE(struct xfs_rud_log_format,	16);
a38ebce1da271f fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  153  	XFS_CHECK_STRUCT_SIZE(struct xfs_map_extent,		32);
a38935c03c7914 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  154  	XFS_CHECK_STRUCT_SIZE(struct xfs_phys_extent,		16);
a38ebce1da271f fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  155  
a38ebce1da271f fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  156  	XFS_CHECK_OFFSET(struct xfs_bui_log_format, bui_extents,	16);
a38935c03c7914 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  157  	XFS_CHECK_OFFSET(struct xfs_cui_log_format, cui_extents,	16);
b45ca961e94673 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  158  	XFS_CHECK_OFFSET(struct xfs_rui_log_format, rui_extents,	16);
03a7485cd701e1 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  159  	XFS_CHECK_OFFSET(struct xfs_efi_log_format, efi_extents,	16);
03a7485cd701e1 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  160  	XFS_CHECK_OFFSET(struct xfs_efi_log_format_32, efi_extents,	16);
03a7485cd701e1 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2022-10-20  161  	XFS_CHECK_OFFSET(struct xfs_efi_log_format_64, efi_extents,	16);
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  162  
233f4e12bbb2c5 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-04-22  163  	/* parent pointer ioctls */
233f4e12bbb2c5 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-04-22  164  	XFS_CHECK_STRUCT_SIZE(struct xfs_getparents_rec,	32);
233f4e12bbb2c5 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-04-22  165  	XFS_CHECK_STRUCT_SIZE(struct xfs_getparents,		40);
233f4e12bbb2c5 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-04-22  166  	XFS_CHECK_STRUCT_SIZE(struct xfs_getparents_by_handle,	64);
233f4e12bbb2c5 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-04-22  167  
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  168  	/*
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  169  	 * The v5 superblock format extended several v4 header structures with
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  170  	 * additional data. While new fields are only accessible on v5
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  171  	 * superblocks, it's important that the v5 structures place original v4
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  172  	 * fields/headers in the correct location on-disk. For example, we must
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  173  	 * be able to find magic values at the same location in certain blocks
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  174  	 * regardless of superblock version.
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  175  	 *
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  176  	 * The following checks ensure that various v5 data structures place the
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  177  	 * subset of v4 metadata associated with the same type of block at the
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  178  	 * start of the on-disk block. If there is no data structure definition
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  179  	 * for certain types of v4 blocks, traverse down to the first field of
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  180  	 * common metadata (e.g., magic value) and make sure it is at offset
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  181  	 * zero.
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  182  	 */
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  183  	XFS_CHECK_OFFSET(struct xfs_dir3_leaf, hdr.info.hdr,	0);
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  184  	XFS_CHECK_OFFSET(struct xfs_da3_intnode, hdr.info.hdr,	0);
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  185  	XFS_CHECK_OFFSET(struct xfs_dir3_data_hdr, hdr.magic,	0);
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  186  	XFS_CHECK_OFFSET(struct xfs_dir3_free, hdr.hdr.magic,	0);
670105de15cd98 fs/xfs/xfs_ondisk.h        Brian Foster      2019-02-08  187  	XFS_CHECK_OFFSET(struct xfs_attr3_leafblock, hdr.info.hdr, 0);
7035f9724f8497 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2019-07-03  188  
7035f9724f8497 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2019-07-03  189  	XFS_CHECK_STRUCT_SIZE(struct xfs_bulkstat,		192);
5f19c7fc687335 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2019-07-03  190  	XFS_CHECK_STRUCT_SIZE(struct xfs_inumbers,		24);
0448b6f488fa66 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2019-07-03  191  	XFS_CHECK_STRUCT_SIZE(struct xfs_bulkstat_req,		64);
fba9760a433634 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2019-07-03  192  	XFS_CHECK_STRUCT_SIZE(struct xfs_inumbers_req,		64);
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  193  
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  194  	/*
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  195  	 * Make sure the incore inode timestamp range corresponds to hand
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  196  	 * converted values based on the ondisk format specification.
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  197  	 */
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  198  	XFS_CHECK_VALUE(XFS_BIGTIME_TIME_MIN - XFS_BIGTIME_EPOCH_OFFSET,
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  199  			XFS_LEGACY_TIME_MIN);
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  200  	XFS_CHECK_VALUE(XFS_BIGTIME_TIME_MAX - XFS_BIGTIME_EPOCH_OFFSET,
f93e5436f0ee5a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  201  			16299260424LL);
4ea1ff3b49681a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  202  
4ea1ff3b49681a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  203  	/* Do the same with the incore quota expiration range. */
4ea1ff3b49681a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  204  	XFS_CHECK_VALUE(XFS_DQ_BIGTIME_EXPIRY_MIN << XFS_DQ_BIGTIME_SHIFT, 4);
4ea1ff3b49681a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  205  	XFS_CHECK_VALUE(XFS_DQ_BIGTIME_EXPIRY_MAX << XFS_DQ_BIGTIME_SHIFT,
4ea1ff3b49681a fs/xfs/xfs_ondisk.h        Darrick J. Wong   2020-08-17  206  			16299260424LL);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  207  
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  208  	/* stuff we got from xfs/122 */
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  209  	XFS_CHECK_SB_OFFSET(sb_agblklog,		124);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  210  	XFS_CHECK_SB_OFFSET(sb_agblocks,		84);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  211  	XFS_CHECK_SB_OFFSET(sb_agcount,			88);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  212  	XFS_CHECK_SB_OFFSET(sb_bad_features2,		204);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  213  	XFS_CHECK_SB_OFFSET(sb_blocklog,		120);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  214  	XFS_CHECK_SB_OFFSET(sb_blocksize,		4);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  215  	XFS_CHECK_SB_OFFSET(sb_crc,			224);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  216  	XFS_CHECK_SB_OFFSET(sb_dblocks,			8);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  217  	XFS_CHECK_SB_OFFSET(sb_dirblklog,		192);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  218  	XFS_CHECK_SB_OFFSET(sb_fdblocks,		144);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  219  	XFS_CHECK_SB_OFFSET(sb_features2,		200);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  220  	XFS_CHECK_SB_OFFSET(sb_features_compat,		208);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  221  	XFS_CHECK_SB_OFFSET(sb_features_incompat,	216);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  222  	XFS_CHECK_SB_OFFSET(sb_features_log_incompat,	220);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  223  	XFS_CHECK_SB_OFFSET(sb_features_ro_compat,	212);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  224  	XFS_CHECK_SB_OFFSET(sb_flags,			178);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  225  	XFS_CHECK_SB_OFFSET(sb_fname[12],		120);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  226  	XFS_CHECK_SB_OFFSET(sb_frextents,		152);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  227  	XFS_CHECK_SB_OFFSET(sb_gquotino,		168);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  228  	XFS_CHECK_SB_OFFSET(sb_icount,			128);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  229  	XFS_CHECK_SB_OFFSET(sb_ifree,			136);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  230  	XFS_CHECK_SB_OFFSET(sb_imax_pct,		127);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  231  	XFS_CHECK_SB_OFFSET(sb_inoalignmt,		180);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  232  	XFS_CHECK_SB_OFFSET(sb_inodelog,		122);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  233  	XFS_CHECK_SB_OFFSET(sb_inodesize,		104);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  234  	XFS_CHECK_SB_OFFSET(sb_inopblock,		106);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  235  	XFS_CHECK_SB_OFFSET(sb_inopblog,		123);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  236  	XFS_CHECK_SB_OFFSET(sb_inprogress,		126);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  237  	XFS_CHECK_SB_OFFSET(sb_logblocks,		96);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  238  	XFS_CHECK_SB_OFFSET(sb_logsectlog,		193);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  239  	XFS_CHECK_SB_OFFSET(sb_logsectsize,		194);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  240  	XFS_CHECK_SB_OFFSET(sb_logstart,		48);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  241  	XFS_CHECK_SB_OFFSET(sb_logsunit,		196);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  242  	XFS_CHECK_SB_OFFSET(sb_lsn,			240);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  243  	XFS_CHECK_SB_OFFSET(sb_magicnum,		0);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  244  	XFS_CHECK_SB_OFFSET(sb_meta_uuid,		248);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  245  	XFS_CHECK_SB_OFFSET(sb_pquotino,		232);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  246  	XFS_CHECK_SB_OFFSET(sb_qflags,			176);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  247  	XFS_CHECK_SB_OFFSET(sb_rblocks,			16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  248  	XFS_CHECK_SB_OFFSET(sb_rbmblocks,		92);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  249  	XFS_CHECK_SB_OFFSET(sb_rbmino,			64);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  250  	XFS_CHECK_SB_OFFSET(sb_rextents,		24);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  251  	XFS_CHECK_SB_OFFSET(sb_rextsize,		80);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  252  	XFS_CHECK_SB_OFFSET(sb_rextslog,		125);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  253  	XFS_CHECK_SB_OFFSET(sb_rootino,			56);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  254  	XFS_CHECK_SB_OFFSET(sb_rsumino,			72);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  255  	XFS_CHECK_SB_OFFSET(sb_sectlog,			121);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  256  	XFS_CHECK_SB_OFFSET(sb_sectsize,		102);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  257  	XFS_CHECK_SB_OFFSET(sb_shared_vn,		179);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  258  	XFS_CHECK_SB_OFFSET(sb_spino_align,		228);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  259  	XFS_CHECK_SB_OFFSET(sb_unit,			184);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  260  	XFS_CHECK_SB_OFFSET(sb_uquotino,		160);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  261  	XFS_CHECK_SB_OFFSET(sb_uuid,			32);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  262  	XFS_CHECK_SB_OFFSET(sb_versionnum,		100);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  263  	XFS_CHECK_SB_OFFSET(sb_width,			188);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  264  
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  265  	XFS_CHECK_STRUCT_SIZE(struct xfs_ag_geometry,			128);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  266  	XFS_CHECK_STRUCT_SIZE(struct xfs_alloc_rec,			8);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  267  	XFS_CHECK_STRUCT_SIZE(struct xfs_alloc_rec_incore,		8);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  268  	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_entry,		8);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  269  	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_hdr,			32);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  270  	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_map,			4);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  271  	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_name_local,		4);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  272  	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_name_remote,		12);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  273  	XFS_CHECK_STRUCT_SIZE(struct xfs_attrlist_cursor,		16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  274  	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_sf_entry,			3);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  275  	XFS_CHECK_STRUCT_SIZE(xfs_bmdr_key_t,				8);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  276  	XFS_CHECK_STRUCT_SIZE(struct xfs_bulk_ireq,			64);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  277  	XFS_CHECK_STRUCT_SIZE(struct xfs_commit_range,			88);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  278  	XFS_CHECK_STRUCT_SIZE(struct xfs_da_blkinfo,			12);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  279  	XFS_CHECK_STRUCT_SIZE(struct xfs_da_intnode,			16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  280  	XFS_CHECK_STRUCT_SIZE(struct xfs_da_node_entry,			8);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  281  	XFS_CHECK_STRUCT_SIZE(struct xfs_da_node_hdr,			16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  282  	XFS_CHECK_STRUCT_SIZE(enum xfs_dinode_fmt,			4);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  283  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_data_free,		4);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  284  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_data_hdr,			16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  285  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_data_unused,		6);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  286  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_free,			16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  287  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_free_hdr,			16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  288  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf,			16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  289  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf_entry,		8);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  290  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf_hdr,			16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  291  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf_tail,		4);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  292  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_sf_entry,			3);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  293  	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_sf_hdr,			10);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  294  	XFS_CHECK_STRUCT_SIZE(struct xfs_error_injection,		8);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  295  	XFS_CHECK_STRUCT_SIZE(struct xfs_exchange_range,		40);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  296  	XFS_CHECK_STRUCT_SIZE(xfs_exntst_t,				4);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  297  	XFS_CHECK_STRUCT_SIZE(struct xfs_fid,				16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  298  	XFS_CHECK_STRUCT_SIZE(struct xfs_fs_eofblocks,			128);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  299  	XFS_CHECK_STRUCT_SIZE(struct xfs_fsid,				8);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  300  	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_counts,			32);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  301  	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom,			256);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11 @302  	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v1,			112);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  303  	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v4,			112);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  304  	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_resblks,			16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  305  	XFS_CHECK_STRUCT_SIZE(struct xfs_growfs_log,			8);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  306  	XFS_CHECK_STRUCT_SIZE(struct xfs_handle,			24);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  307  	XFS_CHECK_STRUCT_SIZE(struct xfs_scrub_metadata,		64);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  308  	XFS_CHECK_STRUCT_SIZE(struct xfs_scrub_vec,			16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  309  	XFS_CHECK_STRUCT_SIZE(struct xfs_scrub_vec_head,		40);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  310  	XFS_CHECK_STRUCT_SIZE(struct xfs_unmount_log_format,		8);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  311  	XFS_CHECK_STRUCT_SIZE(struct xfs_xmd_log_format,		16);
19fb443bb75f03 fs/xfs/libxfs/xfs_ondisk.h Darrick J. Wong   2024-10-11  312  	XFS_CHECK_STRUCT_SIZE(struct xfs_xmi_log_format,		88);
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  313  }
30cbc591c34e68 fs/xfs/xfs_ondisk.h        Darrick J. Wong   2016-03-09  314
Darrick J. Wong Oct. 16, 2024, 5:32 p.m. UTC | #11
On Wed, Oct 16, 2024 at 09:01:14AM +1100, Dave Chinner wrote:
> On Tue, Oct 15, 2024 at 09:59:21AM -0700, Darrick J. Wong wrote:
> > On Tue, Oct 15, 2024 at 08:09:53PM +1100, Dave Chinner wrote:
> > > On Fri, Oct 11, 2024 at 11:24:07AM -0700, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > 
> > > > Check this with every kernel and userspace build, so we can drop the
> > > > nonsense in xfs/122.  Roughly drafted with:
> > > > 
> > > > sed -e 's/^offsetof/\tXFS_CHECK_OFFSET/g' \
> > > > 	-e 's/^sizeof/\tXFS_CHECK_STRUCT_SIZE/g' \
> > > > 	-e 's/ = \([0-9]*\)/,\t\t\t\1);/g' \
> > > > 	-e 's/xfs_sb_t/struct xfs_dsb/g' \
> > > > 	-e 's/),/,/g' \
> > > > 	-e 's/xfs_\([a-z0-9_]*\)_t,/struct xfs_\1,/g' \
> > > > 	< tests/xfs/122.out | sort
> > > > 
> > > > and then manual fixups.
> > > 
> > > [snip on disk structures]
> > > 
> > > I don't think we can type check all these ioctl structures,
> > > especially the old ones.
> > > 
> > > i.e. The old ioctl structures are not padded to 64 bit boundaries,
> > > nor are they constructed without internal padding holes, and this is
> > > why compat ioctls exist. Hence any ioctl structure that has a compat
> > > definition in xfs_ioctl32.h can't be size checked like this....
> > > 
> > > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_error_injection,		8);
> > > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_exchange_range,		40);
> > > > +	XFS_CHECK_STRUCT_SIZE(xfs_exntst_t,				4);
> > > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fid,				16);
> > > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fs_eofblocks,			128);
> > > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsid,				8);
> > > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_counts,			32);
> > > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom,			256);
> > > > +	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v1,			112);
> > > 
> > > e.g. xfs_fsop_geom_v1 is 108 bytes on 32 bit systems, not 112:
> > > 
> > > struct compat_xfs_fsop_geom_v1 {
> > >         __u32                      blocksize;            /*     0     4 */
> > >         __u32                      rtextsize;            /*     4     4 */
> > >         __u32                      agblocks;             /*     8     4 */
> > >         __u32                      agcount;              /*    12     4 */
> > >         __u32                      logblocks;            /*    16     4 */
> > >         __u32                      sectsize;             /*    20     4 */
> > >         __u32                      inodesize;            /*    24     4 */
> > >         __u32                      imaxpct;              /*    28     4 */
> > >         __u64                      datablocks;           /*    32     8 */
> > >         __u64                      rtblocks;             /*    40     8 */
> > >         __u64                      rtextents;            /*    48     8 */
> > >         __u64                      logstart;             /*    56     8 */
> > >         /* --- cacheline 1 boundary (64 bytes) --- */
> > >         unsigned char              uuid[16];             /*    64    16 */
> > >         __u32                      sunit;                /*    80     4 */
> > >         __u32                      swidth;               /*    84     4 */
> > >         __s32                      version;              /*    88     4 */
> > >         __u32                      flags;                /*    92     4 */
> > >         __u32                      logsectsize;          /*    96     4 */
> > >         __u32                      rtsectsize;           /*   100     4 */
> > >         __u32                      dirblocksize;         /*   104     4 */
> > > 
> > >         /* size: 108, cachelines: 2, members: 20 */
> > >         /* last cacheline: 44 bytes */
> > > } __attribute__((__packed__));
> > > 
> > > I'm not sure we need to size check these structures - if they change
> > > size, the ioctl number will change and that means all the userspace
> > > test code built against the system /usr/include/xfs/xfs_fs.h file
> > > that exercises the ioctls will stop working, right? i.e. breakage
> > > should be pretty obvious...
> > 
> > It should, though I worry about the case where we accidentally change
> > the size on some weird architecture, some distro ships a new release
> > with everything built against the broken headers, and only later does
> > someone notice that their old program now starts failing.
> > 
> > I guess the question is, do we hardcode the known sizes here, e.g.
> > 
> > 	XFS_CHECK_IOCTL_SIZE(struct xfs_fsop_geom_v1, 108, 112);
> > 
> > wherein we'd assert that sizeof() == 108 || sizeof() == 112?
> 
> This feels kinda fragile. We want the compiler to do the validation
> work for both the normal and compat ioctl structures. Just
> specifying two sizes doesn't actually do that.
> 
> i.e. this really needs to check that the structure size is the same
> on all 64 bit platforms, the compat structure is the same on -all-
> platforms (32 and 64 bit), and that the the structure size is the
> same as the compat structure size on all 32 bit platforms....
> 
> > Or not care if things happen to the ioctls?  Part of aim of this posting
> > was to trick the build bots into revealing which architectures break on
> > the compat ioctl stuff... ;)
> 
> If that's your goal, then this needs to be validating the compat
> structures are the correct size, too.

My goal was to get rid of xfs/122 but as this is turning into a messy
cleanup I'm going to drop the whole thing on the floor.  I don't think
anyone runs xfs/122 anyway so I'll just put it in my expunge list;
someone else who isn't as burned out as I am can pick it up if they
choose.

--D

> -Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
>
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_ondisk.h b/fs/xfs/libxfs/xfs_ondisk.h
index 23c133fd36f5bb..89d9139394c466 100644
--- a/fs/xfs/libxfs/xfs_ondisk.h
+++ b/fs/xfs/libxfs/xfs_ondisk.h
@@ -19,6 +19,10 @@ 
 	static_assert((value) == (expected), \
 		"XFS: value of " #value " is wrong, expected " #expected)
 
+#define XFS_CHECK_SB_OFFSET(field, offset) \
+	XFS_CHECK_OFFSET(struct xfs_dsb, field, offset); \
+	XFS_CHECK_OFFSET(struct xfs_sb, field, offset);
+
 static inline void __init
 xfs_check_ondisk_structs(void)
 {
@@ -85,7 +89,6 @@  xfs_check_ondisk_structs(void)
 	XFS_CHECK_STRUCT_SIZE(xfs_attr_leaf_name_remote_t,	12);
 	 */
 
-	XFS_CHECK_OFFSET(struct xfs_dsb, sb_crc,		224);
 	XFS_CHECK_OFFSET(xfs_attr_leaf_name_local_t, valuelen,	0);
 	XFS_CHECK_OFFSET(xfs_attr_leaf_name_local_t, namelen,	2);
 	XFS_CHECK_OFFSET(xfs_attr_leaf_name_local_t, nameval,	3);
@@ -201,6 +204,112 @@  xfs_check_ondisk_structs(void)
 	XFS_CHECK_VALUE(XFS_DQ_BIGTIME_EXPIRY_MIN << XFS_DQ_BIGTIME_SHIFT, 4);
 	XFS_CHECK_VALUE(XFS_DQ_BIGTIME_EXPIRY_MAX << XFS_DQ_BIGTIME_SHIFT,
 			16299260424LL);
+
+	/* stuff we got from xfs/122 */
+	XFS_CHECK_SB_OFFSET(sb_agblklog,		124);
+	XFS_CHECK_SB_OFFSET(sb_agblocks,		84);
+	XFS_CHECK_SB_OFFSET(sb_agcount,			88);
+	XFS_CHECK_SB_OFFSET(sb_bad_features2,		204);
+	XFS_CHECK_SB_OFFSET(sb_blocklog,		120);
+	XFS_CHECK_SB_OFFSET(sb_blocksize,		4);
+	XFS_CHECK_SB_OFFSET(sb_crc,			224);
+	XFS_CHECK_SB_OFFSET(sb_dblocks,			8);
+	XFS_CHECK_SB_OFFSET(sb_dirblklog,		192);
+	XFS_CHECK_SB_OFFSET(sb_fdblocks,		144);
+	XFS_CHECK_SB_OFFSET(sb_features2,		200);
+	XFS_CHECK_SB_OFFSET(sb_features_compat,		208);
+	XFS_CHECK_SB_OFFSET(sb_features_incompat,	216);
+	XFS_CHECK_SB_OFFSET(sb_features_log_incompat,	220);
+	XFS_CHECK_SB_OFFSET(sb_features_ro_compat,	212);
+	XFS_CHECK_SB_OFFSET(sb_flags,			178);
+	XFS_CHECK_SB_OFFSET(sb_fname[12],		120);
+	XFS_CHECK_SB_OFFSET(sb_frextents,		152);
+	XFS_CHECK_SB_OFFSET(sb_gquotino,		168);
+	XFS_CHECK_SB_OFFSET(sb_icount,			128);
+	XFS_CHECK_SB_OFFSET(sb_ifree,			136);
+	XFS_CHECK_SB_OFFSET(sb_imax_pct,		127);
+	XFS_CHECK_SB_OFFSET(sb_inoalignmt,		180);
+	XFS_CHECK_SB_OFFSET(sb_inodelog,		122);
+	XFS_CHECK_SB_OFFSET(sb_inodesize,		104);
+	XFS_CHECK_SB_OFFSET(sb_inopblock,		106);
+	XFS_CHECK_SB_OFFSET(sb_inopblog,		123);
+	XFS_CHECK_SB_OFFSET(sb_inprogress,		126);
+	XFS_CHECK_SB_OFFSET(sb_logblocks,		96);
+	XFS_CHECK_SB_OFFSET(sb_logsectlog,		193);
+	XFS_CHECK_SB_OFFSET(sb_logsectsize,		194);
+	XFS_CHECK_SB_OFFSET(sb_logstart,		48);
+	XFS_CHECK_SB_OFFSET(sb_logsunit,		196);
+	XFS_CHECK_SB_OFFSET(sb_lsn,			240);
+	XFS_CHECK_SB_OFFSET(sb_magicnum,		0);
+	XFS_CHECK_SB_OFFSET(sb_meta_uuid,		248);
+	XFS_CHECK_SB_OFFSET(sb_pquotino,		232);
+	XFS_CHECK_SB_OFFSET(sb_qflags,			176);
+	XFS_CHECK_SB_OFFSET(sb_rblocks,			16);
+	XFS_CHECK_SB_OFFSET(sb_rbmblocks,		92);
+	XFS_CHECK_SB_OFFSET(sb_rbmino,			64);
+	XFS_CHECK_SB_OFFSET(sb_rextents,		24);
+	XFS_CHECK_SB_OFFSET(sb_rextsize,		80);
+	XFS_CHECK_SB_OFFSET(sb_rextslog,		125);
+	XFS_CHECK_SB_OFFSET(sb_rootino,			56);
+	XFS_CHECK_SB_OFFSET(sb_rsumino,			72);
+	XFS_CHECK_SB_OFFSET(sb_sectlog,			121);
+	XFS_CHECK_SB_OFFSET(sb_sectsize,		102);
+	XFS_CHECK_SB_OFFSET(sb_shared_vn,		179);
+	XFS_CHECK_SB_OFFSET(sb_spino_align,		228);
+	XFS_CHECK_SB_OFFSET(sb_unit,			184);
+	XFS_CHECK_SB_OFFSET(sb_uquotino,		160);
+	XFS_CHECK_SB_OFFSET(sb_uuid,			32);
+	XFS_CHECK_SB_OFFSET(sb_versionnum,		100);
+	XFS_CHECK_SB_OFFSET(sb_width,			188);
+
+	XFS_CHECK_STRUCT_SIZE(struct xfs_ag_geometry,			128);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_alloc_rec,			8);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_alloc_rec_incore,		8);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_entry,		8);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_hdr,			32);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_map,			4);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_name_local,		4);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_leaf_name_remote,		12);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_attrlist_cursor,		16);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_attr_sf_entry,			3);
+	XFS_CHECK_STRUCT_SIZE(xfs_bmdr_key_t,				8);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_bulk_ireq,			64);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_commit_range,			88);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_da_blkinfo,			12);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_da_intnode,			16);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_da_node_entry,			8);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_da_node_hdr,			16);
+	XFS_CHECK_STRUCT_SIZE(enum xfs_dinode_fmt,			4);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_data_free,		4);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_data_hdr,			16);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_data_unused,		6);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_free,			16);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_free_hdr,			16);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf,			16);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf_entry,		8);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf_hdr,			16);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_leaf_tail,		4);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_sf_entry,			3);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_dir2_sf_hdr,			10);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_error_injection,		8);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_exchange_range,		40);
+	XFS_CHECK_STRUCT_SIZE(xfs_exntst_t,				4);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_fid,				16);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_fs_eofblocks,			128);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_fsid,				8);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_counts,			32);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom,			256);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v1,			112);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_geom_v4,			112);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_fsop_resblks,			16);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_growfs_log,			8);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_handle,			24);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_scrub_metadata,		64);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_scrub_vec,			16);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_scrub_vec_head,		40);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_unmount_log_format,		8);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_xmd_log_format,		16);
+	XFS_CHECK_STRUCT_SIZE(struct xfs_xmi_log_format,		88);
 }
 
 #endif /* __XFS_ONDISK_H */