On Thu, Feb 07, 2019 at 11:10:06AM -0800, Darrick J. Wong wrote: > On Thu, Feb 07, 2019 at 01:41:03PM -0500, Brian Foster wrote: > > The dir2 leaf verifiers share the same underlying structure > > verification code, but implement six accessor functions to multiplex > > the code across the two verifiers. Further, the magic value isn't > > sufficiently abstracted such that the common helper has to manually > > fix up the magic from the caller on v5 filesystems. > > > > Use the magic field in the verifier structure to eliminate the > > duplicate code and clean this all up. No functional change. > > > > Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx> > > --- > > fs/xfs/libxfs/xfs_dir2_leaf.c | 87 ++++++++--------------------------- > > fs/xfs/xfs_ondisk.h | 11 +++++ > > 2 files changed, 30 insertions(+), 68 deletions(-) > > ... > > diff --git a/fs/xfs/xfs_ondisk.h b/fs/xfs/xfs_ondisk.h > > index d3e04d20d8d4..0209f3e91254 100644 > > --- a/fs/xfs/xfs_ondisk.h > > +++ b/fs/xfs/xfs_ondisk.h > > @@ -125,6 +125,17 @@ xfs_check_ondisk_structs(void) > > XFS_CHECK_STRUCT_SIZE(struct xfs_inode_log_format, 56); > > XFS_CHECK_STRUCT_SIZE(struct xfs_qoff_logformat, 20); > > XFS_CHECK_STRUCT_SIZE(struct xfs_trans_header, 16); > > + > > + /* > > + * Magic value offset checks. These are here because certain on-disk > > + * structures are updated to include more information on v5 filesystems. > > + * While different in-core data structures are used depending on fs > > + * version, some buffer verifiers expect to be able to use either > > + * structure to locate the magic value as it should always be in the > > + * same place. > > + */ > > + XFS_CHECK_OFFSET(struct xfs_dir2_leaf, hdr.info.magic, 8); > > + XFS_CHECK_OFFSET(struct xfs_dir3_leaf_hdr, info.hdr.magic, 8); > > Sorry for the nitpick, but why not > > XFS_CHECK_OFFSET(struct xfs_dir3_leaf, hdr.info.hdr.magic, 8) ? > I just used the structure(s) as used in the verifiers. I have no real preference as to whether we use that or the higher/top level structures. Brian > --D > > > } > > > > #endif /* __XFS_ONDISK_H */ > > -- > > 2.17.2 > >