#define XFSLABEL_MAX 12
/*
- * Superblock - in core version. Must be padded to 64 bit alignment.
+ * Superblock - in core version. Must match the ondisk version below.
+ * Must be padded to 64 bit alignment.
*/
typedef struct xfs_sb {
uint32_t sb_magicnum; /* magic number == XFS_SB_MAGIC */
xfs_lsn_t sb_lsn; /* last write sequence */
uuid_t sb_meta_uuid; /* metadata file system unique id */
- /* Fields beyond here do not match xfs_dsb. Be very careful! */
-
- /*
- * Metadata Directory Inode. On disk this lives in the sb_rbmino slot,
- * but we continue to use the in-core superblock to cache the classic
- * inodes (rt bitmap; rt summary; user, group, and project quotas) so
- * we cache the metadir inode value here too.
- */
- xfs_ino_t sb_metadirino;
-
- /*
- * Realtime group geometry information. On disk these fields live in
- * the rsumino slot, but we cache them separately in the in-core super
- * for easy access.
- */
- xfs_rgblock_t sb_rgblocks; /* size of a realtime group */
- xfs_rgnumber_t sb_rgcount; /* number of realtime groups */
+ xfs_ino_t sb_metadirino; /* metadir ino # */
+ xfs_rgnumber_t sb_rgcount; /* # of realtime groups */
+ xfs_rgblock_t sb_rgblocks; /* rtblocks per group */
/* must be padded to 64 bit alignment */
} xfs_sb_t;
/*
- * Superblock - on disk version.
+ * Superblock - on disk version. Must match the in core version above.
* Must be padded to 64 bit alignment.
+ *
+ * Note: any newly added field needs to be accounted for in
+ * secondary_sb_whack() in xfs_repair.
*/
struct xfs_dsb {
__be32 sb_magicnum; /* magic number == XFS_SB_MAGIC */
uuid_t sb_uuid; /* user-visible file system unique id */
__be64 sb_logstart; /* starting block of log if internal */
__be64 sb_rootino; /* root inode number */
- /*
- * bitmap inode for realtime extents.
- *
- * The metadata directory feature uses the sb_rbmino field to point to
- * the root of the metadata directory tree. All other sb inode
- * pointers are no longer used.
- */
- __be64 sb_rbmino;
- /*
- * rtgroups requires metadir, so we reuse the rsumino space to hold
- * the rg block count and shift values.
- */
- union {
- __be64 sb_rsumino; /* summary inode for rt bitmap */
- struct {
- __be32 sb_rgcount; /* # of realtime groups */
- __be32 sb_rgblocks; /* rtblocks per group */
- };
- };
+ __be64 sb_rbmino; /* bitmap inode for realtime extents */
+ __be64 sb_rsumino; /* summary inode for rt bitmap */
__be32 sb_rextsize; /* realtime extent size, blocks */
__be32 sb_agblocks; /* size of an allocation group */
__be32 sb_agcount; /* number of allocation groups */
__be64 sb_lsn; /* last write sequence */
uuid_t sb_meta_uuid; /* metadata file system unique id */
+ __be64 sb_metadirino; /* metadir ino # */
+ __be32 sb_rgcount; /* # of realtime groups */
+ __be32 sb_rgblocks; /* rtblocks per group */
+
/* must be padded to 64 bit alignment */
};
XFS_CHECK_STRUCT_SIZE(struct xfs_dinode, 176);
XFS_CHECK_STRUCT_SIZE(struct xfs_disk_dquot, 104);
XFS_CHECK_STRUCT_SIZE(struct xfs_dqblk, 136);
- XFS_CHECK_STRUCT_SIZE(struct xfs_dsb, 264);
+ XFS_CHECK_STRUCT_SIZE(struct xfs_dsb, 280);
XFS_CHECK_STRUCT_SIZE(struct xfs_dsymlink_hdr, 56);
XFS_CHECK_STRUCT_SIZE(struct xfs_inobt_key, 4);
XFS_CHECK_STRUCT_SIZE(struct xfs_inobt_rec, 16);
if (convert_xquota)
xfs_sb_quota_from_disk(to);
- if (to->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_METADIR) {
- /*
- * Set metadirino here and null out the in-core fields for
- * the other inodes because metadir initialization will load
- * them later.
- */
- to->sb_metadirino = be64_to_cpu(from->sb_rbmino);
- to->sb_rbmino = NULLFSINO;
- to->sb_rsumino = NULLFSINO;
-
- /*
- * We don't have to worry about quota inode conversion here
- * because metadir requires a v5 filesystem.
- */
- to->sb_uquotino = NULLFSINO;
- to->sb_gquotino = NULLFSINO;
- to->sb_pquotino = NULLFSINO;
- }
+ if (to->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_METADIR)
+ to->sb_metadirino = be64_to_cpu(from->sb_metadirino);
if (to->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_RTGROUPS) {
to->sb_rgcount = be32_to_cpu(from->sb_rgcount);
if (from->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_META_UUID)
uuid_copy(&to->sb_meta_uuid, &from->sb_meta_uuid);
- if (from->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_METADIR) {
- /*
- * Save metadirino here and null out the on-disk fields for
- * the other inodes, at least until we reuse the fields.
- */
- to->sb_rbmino = cpu_to_be64(from->sb_metadirino);
- to->sb_rsumino = cpu_to_be64(NULLFSINO);
- to->sb_uquotino = cpu_to_be64(NULLFSINO);
- to->sb_gquotino = cpu_to_be64(NULLFSINO);
- to->sb_pquotino = cpu_to_be64(NULLFSINO);
- }
+ if (from->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_METADIR)
+ to->sb_metadirino = cpu_to_be64(from->sb_metadirino);
if (from->sb_features_incompat & XFS_SB_FEAT_INCOMPAT_RTGROUPS) {
- /* must come after setting to_rsumino */
to->sb_rgcount = cpu_to_be32(from->sb_rgcount);
to->sb_rgblocks = cpu_to_be32(from->sb_rgblocks);
}