aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_sb.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2019-02-07 10:45:48 -0800
committerDarrick J. Wong <darrick.wong@oracle.com>2019-02-11 16:07:01 -0800
commit39708c20ab51337c3eb282a824eb0aaff7ebe2e1 (patch)
treead3e741a8fbafdfa13531f9efdf91557daada42d /fs/xfs/libxfs/xfs_sb.c
parentxfs: use verifier magic field in dir2 leaf verifiers (diff)
downloadlinux-dev-39708c20ab51337c3eb282a824eb0aaff7ebe2e1.tar.xz
linux-dev-39708c20ab51337c3eb282a824eb0aaff7ebe2e1.zip
xfs: miscellaneous verifier magic value fixups
Most buffer verifiers have hardcoded magic value checks conditionalized on the version of the filesystem. The magic value field of the verifier structure facilitates abstraction of some of this code. Populate the ->magic field of various verifiers to take advantage of this abstraction. No functional changes. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_sb.c')
-rw-r--r--fs/xfs/libxfs/xfs_sb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index a2f52a958091..4e5029c37966 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -229,7 +229,7 @@ xfs_validate_sb_common(
uint32_t agcount = 0;
uint32_t rem;
- if (dsb->sb_magicnum != cpu_to_be32(XFS_SB_MAGIC)) {
+ if (!xfs_verify_magic(bp, dsb->sb_magicnum)) {
xfs_warn(mp, "bad magic number");
return -EWRONGFS;
}
@@ -782,12 +782,14 @@ out_error:
const struct xfs_buf_ops xfs_sb_buf_ops = {
.name = "xfs_sb",
+ .magic = { cpu_to_be32(XFS_SB_MAGIC), cpu_to_be32(XFS_SB_MAGIC) },
.verify_read = xfs_sb_read_verify,
.verify_write = xfs_sb_write_verify,
};
const struct xfs_buf_ops xfs_sb_quiet_buf_ops = {
.name = "xfs_sb_quiet",
+ .magic = { cpu_to_be32(XFS_SB_MAGIC), cpu_to_be32(XFS_SB_MAGIC) },
.verify_read = xfs_sb_quiet_read_verify,
.verify_write = xfs_sb_write_verify,
};