/* * copy the fields of a superblock that are present in primary and * secondaries -- preserve fields that are different in the primary. */ static void copy_sb(xfs_sb_t *source, xfs_sb_t *dest) { xfs_ino_t rootino; xfs_ino_t rbmino; xfs_ino_t rsumino; xfs_ino_t uquotino; xfs_ino_t gquotino; __uint16_t versionnum; rootino = dest->sb_rootino; rbmino = dest->sb_rbmino; rsumino = dest->sb_rsumino; uquotino = dest->sb_uquotino; gquotino = dest->sb_gquotino; versionnum = dest->sb_versionnum; *dest = *source; dest->sb_rootino = rootino; dest->sb_rbmino = rbmino; dest->sb_rsumino = rsumino; dest->sb_uquotino = uquotino; dest->sb_gquotino = gquotino; dest->sb_versionnum = versionnum; /* * copy over version bits that are stamped into all * secondaries and cannot be changed at run time in * the primary superblock */ if (xfs_sb_version_hasdalign(source)) dest->sb_versionnum |= XFS_SB_VERSION_DALIGNBIT; if (xfs_sb_version_hasextflgbit(source)) dest->sb_versionnum |= XFS_SB_VERSION_EXTFLGBIT; /* * these are all supposed to be zero or will get reset anyway */ dest->sb_icount = 0; dest->sb_ifree = 0; dest->sb_fdblocks = 0; dest->sb_frextents = 0; memset(source->sb_fname, 0, 12); }
static char * version_string( xfs_sb_t *sbp) { static char s[1024]; if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_1) strcpy(s, "V1"); else if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_2) strcpy(s, "V2"); else if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_3) strcpy(s, "V3"); else if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_4) strcpy(s, "V4"); else if (XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5) strcpy(s, "V5"); /* * We assume the state of these features now, so macros don't exist for * them any more. */ if (sbp->sb_versionnum & XFS_SB_VERSION_NLINKBIT) strcat(s, ",NLINK"); if (sbp->sb_versionnum & XFS_SB_VERSION_SHAREDBIT) strcat(s, ",SHARED"); if (sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT) strcat(s, ",DIRV2"); if (xfs_sb_version_hasattr(sbp)) strcat(s, ",ATTR"); if (xfs_sb_version_hasquota(sbp)) strcat(s, ",QUOTA"); if (xfs_sb_version_hasalign(sbp)) strcat(s, ",ALIGN"); if (xfs_sb_version_hasdalign(sbp)) strcat(s, ",DALIGN"); if (xfs_sb_version_haslogv2(sbp)) strcat(s, ",LOGV2"); if (xfs_sb_version_hasextflgbit(sbp)) strcat(s, ",EXTFLG"); if (xfs_sb_version_hassector(sbp)) strcat(s, ",SECTOR"); if (xfs_sb_version_hasasciici(sbp)) strcat(s, ",ASCII_CI"); if (xfs_sb_version_hasmorebits(sbp)) strcat(s, ",MOREBITS"); if (xfs_sb_version_hasattr2(sbp)) strcat(s, ",ATTR2"); if (xfs_sb_version_haslazysbcount(sbp)) strcat(s, ",LAZYSBCOUNT"); if (xfs_sb_version_hasprojid32bit(sbp)) strcat(s, ",PROJID32BIT"); if (xfs_sb_version_hascrc(sbp)) strcat(s, ",CRC"); if (xfs_sb_version_hasftype(sbp)) strcat(s, ",FTYPE"); if (xfs_sb_version_hasfinobt(sbp)) strcat(s, ",FINOBT"); if (xfs_sb_version_hassparseinodes(sbp)) strcat(s, ",SPARSE_INODES"); if (xfs_sb_version_hasmetauuid(sbp)) strcat(s, ",META_UUID"); return s; }
void get_sb_geometry(fs_geometry_t *geo, xfs_sb_t *sbp) { memset(geo, 0, sizeof(fs_geometry_t)); /* * blindly set fields that we know are always good */ geo->sb_blocksize = sbp->sb_blocksize; geo->sb_dblocks = sbp->sb_dblocks; geo->sb_rblocks = sbp->sb_rblocks; geo->sb_rextents = sbp->sb_rextents; geo->sb_logstart = sbp->sb_logstart; geo->sb_rextsize = sbp->sb_rextsize; geo->sb_agblocks = sbp->sb_agblocks; geo->sb_agcount = sbp->sb_agcount; geo->sb_rbmblocks = sbp->sb_rbmblocks; geo->sb_logblocks = sbp->sb_logblocks; geo->sb_sectsize = sbp->sb_sectsize; geo->sb_inodesize = sbp->sb_inodesize; if (xfs_sb_version_hasalign(sbp)) geo->sb_ialignbit = 1; if (xfs_sb_version_hasshared(sbp) || sbp->sb_versionnum & XR_PART_SECSB_VNMASK) geo->sb_sharedbit = 1; if (xfs_sb_version_hasdalign(sbp)) geo->sb_salignbit = 1; if (xfs_sb_version_hasextflgbit(sbp)) geo->sb_extflgbit = 1; /* * protect against pre-6.5 mkfs-generated garbaged * fields in the secondary superblocks. pay attention * to those fields if and only if their corresponding * feature bits are set in the feature bits of the * version number or we can deduce from the version bits * that are set that our field was properly initialized * because a field after the field we care about was * properly initialized as well. */ /* * inode alignment field lives before the data alignment field */ if ((!pre_65_beta && (sbp->sb_versionnum & XR_PART_SECSB_VNMASK)) || (pre_65_beta && (sbp->sb_versionnum & XR_ALPHA_SECSB_VNMASK))) geo->sb_inoalignmt = sbp->sb_inoalignmt; if ((!pre_65_beta && (sbp->sb_versionnum & XR_GOOD_SECSB_VNMASK)) || (pre_65_beta && xfs_sb_version_hasdalign(sbp))) { geo->sb_unit = sbp->sb_unit; geo->sb_width = sbp->sb_width; } /* * shared vn always set if either ino or data alignment is on * since that field lives between the quota and inode alignment * fields */ if (sbp->sb_versionnum & XR_PART_SECSB_VNMASK) geo->sb_shared_vn = sbp->sb_shared_vn; /* * superblock fields located after sb_widthfields get set * into the geometry structure only if we can determine * from the features enabled in this superblock whether * or not the sector was zero'd at mkfs time. */ if ((!pre_65_beta && (sbp->sb_versionnum & XR_GOOD_SECSB_VNMASK)) || (pre_65_beta && (sbp->sb_versionnum & XR_ALPHA_SECSB_VNMASK))) { geo->sb_fully_zeroed = 1; } }
int verify_sb(xfs_sb_t *sb, int is_primary_sb) { __uint32_t bsize; xfs_extlen_t align; int i; /* check magic number and version number */ if (sb->sb_magicnum != XFS_SB_MAGIC) return(XR_BAD_MAGIC); if (!xfs_sb_good_version(sb)) return(XR_BAD_VERSION); /* does sb think mkfs really finished ? */ if (is_primary_sb && sb->sb_inprogress == 1) return(XR_BAD_INPROGRESS); /* check to make sure blocksize is legal 2^N, 9 <= N <= 16 */ if (sb->sb_blocksize == 0) return(XR_BAD_BLOCKSIZE); bsize = 1; for (i = 0; bsize < sb->sb_blocksize && i < sizeof(sb->sb_blocksize) * NBBY; i++) bsize <<= 1; if (i < XFS_MIN_BLOCKSIZE_LOG || i > XFS_MAX_BLOCKSIZE_LOG) return(XR_BAD_BLOCKSIZE); /* check sb blocksize field against sb blocklog field */ if (i != sb->sb_blocklog) return(XR_BAD_BLOCKLOG); /* sanity check ag count, size fields against data size field */ if (sb->sb_dblocks == 0 || sb->sb_dblocks > ((__uint64_t)sb->sb_agcount * sb->sb_agblocks) || sb->sb_dblocks < ((__uint64_t)(sb->sb_agcount - 1) * sb->sb_agblocks + XFS_MIN_AG_BLOCKS)) return(XR_BAD_FS_SIZE_DATA); if (sb->sb_agblklog != (__uint8_t)libxfs_log2_roundup(sb->sb_agblocks)) return(XR_BAD_FS_SIZE_DATA); if (sb->sb_inodesize < XFS_DINODE_MIN_SIZE || sb->sb_inodesize > XFS_DINODE_MAX_SIZE || sb->sb_inopblock != howmany(sb->sb_blocksize,sb->sb_inodesize)) return(XR_BAD_INO_SIZE_DATA); /* check to make sure sectorsize is legal 2^N, 9 <= N <= 15 */ if (sb->sb_sectsize == 0) return(XR_BAD_SECT_SIZE_DATA); bsize = 1; for (i = 0; bsize < sb->sb_sectsize && i < sizeof(sb->sb_sectsize) * NBBY; i++) { bsize <<= 1; } if (i < XFS_MIN_SECTORSIZE_LOG || i > XFS_MAX_SECTORSIZE_LOG) return(XR_BAD_SECT_SIZE_DATA); /* check sb sectorsize field against sb sectlog field */ if (i != sb->sb_sectlog) return(XR_BAD_SECT_SIZE_DATA); if (xfs_sb_version_hassector(sb)) { /* check to make sure log sector is legal 2^N, 9 <= N <= 15 */ if (sb->sb_logsectsize == 0) return(XR_BAD_SECT_SIZE_DATA); bsize = 1; for (i = 0; bsize < sb->sb_logsectsize && i < sizeof(sb->sb_logsectsize) * NBBY; i++) { bsize <<= 1; } if (i < XFS_MIN_SECTORSIZE_LOG || i > XFS_MAX_SECTORSIZE_LOG) return(XR_BAD_SECT_SIZE_DATA); /* check sb log sectorsize field against sb log sectlog field */ if (i != sb->sb_logsectlog) return(XR_BAD_SECT_SIZE_DATA); } /* * real-time extent size is always set */ if (sb->sb_rextsize * sb->sb_blocksize > XFS_MAX_RTEXTSIZE) return(XR_BAD_RT_GEO_DATA); if (sb->sb_rextsize * sb->sb_blocksize < XFS_MIN_RTEXTSIZE) return(XR_BAD_RT_GEO_DATA); if (sb->sb_rblocks == 0) { if (sb->sb_rextents != 0) return(XR_BAD_RT_GEO_DATA); if (sb->sb_rbmblocks != 0) return(XR_BAD_RT_GEO_DATA); if (sb->sb_rextslog != 0) return(XR_BAD_RT_GEO_DATA); if (sb->sb_frextents != 0) return(XR_BAD_RT_GEO_DATA); } else { /* * if we have a real-time partition, sanity-check geometry */ if (sb->sb_rblocks / sb->sb_rextsize != sb->sb_rextents) return(XR_BAD_RT_GEO_DATA); if (sb->sb_rextslog != libxfs_highbit32((unsigned int)sb->sb_rextents)) return(XR_BAD_RT_GEO_DATA); if (sb->sb_rbmblocks != (xfs_extlen_t) howmany(sb->sb_rextents, NBBY * sb->sb_blocksize)) return(XR_BAD_RT_GEO_DATA); } /* * verify correctness of inode alignment if it's there */ if (xfs_sb_version_hasalign(sb)) { align = calc_ino_align(sb); if (align != sb->sb_inoalignmt) return(XR_BAD_INO_ALIGN); } /* * verify max. % of inodes (sb_imax_pct) */ if (sb->sb_imax_pct > 100) return(XR_BAD_INO_MAX_PCT); /* * verify stripe alignment fields if present */ if (xfs_sb_version_hasdalign(sb)) { if ((!sb->sb_unit && sb->sb_width) || (sb->sb_unit && sb->sb_agblocks % sb->sb_unit)) return(XR_BAD_SB_UNIT); if ((sb->sb_unit && !sb->sb_width) || (sb->sb_width && sb->sb_unit && sb->sb_width % sb->sb_unit)) return(XR_BAD_SB_WIDTH); } /* * if shared bit is set, verify that the version number is sane */ if (xfs_sb_version_hasshared(sb)) { if (sb->sb_shared_vn > XFS_SB_MAX_SHARED_VN) return(XR_BAD_SVN); } /* * mkfs's that stamped a feature bit besides the ones in the * mask below could leave garbage in the secondary superblock * sectors. Anything stamping the shared fs bit or better into * the secondaries is ok and should generate clean secondary * superblock sectors. * * check primary and clean secondary superblocks more strictly */ if (is_primary_sb || sb->sb_versionnum & XR_PART_SECSB_VNMASK) { /* * return errors if shared vn or alignment fields * are set without their feature bits being set */ if ((!pre_65_beta && (sb->sb_versionnum & XR_PART_SECSB_VNMASK)) || (pre_65_beta && (sb->sb_versionnum & XR_ALPHA_SECSB_VNMASK))) { /* * shared version # and inode alignment fields * should be valid */ if (sb->sb_shared_vn && !xfs_sb_version_hasshared(sb)) return(XR_BAD_SVN); if (sb->sb_inoalignmt && !xfs_sb_version_hasalign(sb)) return(XR_BAD_INO_ALIGN); } if ((!pre_65_beta && (sb->sb_versionnum & XR_GOOD_SECSB_VNMASK)) || (pre_65_beta && (sb->sb_versionnum & XFS_SB_VERSION_DALIGNBIT))) { /* * stripe alignment values should be valid */ if (sb->sb_unit && !xfs_sb_version_hasdalign(sb)) return(XR_BAD_SB_UNIT); if (sb->sb_width && !xfs_sb_version_hasdalign(sb)) return(XR_BAD_SB_WIDTH); } #if 0 /* * checks involving later superblock fields get added here... */ if (sb->sb_versionnum & XR_GOOD_SECSB_VNMASK) { } #endif } return(XR_OK); }
/* * Mount structure initialization, provides a filled-in xfs_mount_t * such that the numerous XFS_* macros can be used. If dev is zero, * no IO will be performed (no size checks, read root inodes). */ xfs_mount_t * libxfs_mount( xfs_mount_t *mp, xfs_sb_t *sb, dev_t dev, dev_t logdev, dev_t rtdev, int flags) { xfs_daddr_t d; xfs_buf_t *bp; xfs_sb_t *sbp; int error; libxfs_buftarg_init(mp, dev, logdev, rtdev); mp->m_flags = (LIBXFS_MOUNT_32BITINODES|LIBXFS_MOUNT_32BITINOOPT); mp->m_sb = *sb; INIT_RADIX_TREE(&mp->m_perag_tree, GFP_KERNEL); sbp = &(mp->m_sb); xfs_sb_mount_common(mp, sb); xfs_alloc_compute_maxlevels(mp); xfs_bmap_compute_maxlevels(mp, XFS_DATA_FORK); xfs_bmap_compute_maxlevels(mp, XFS_ATTR_FORK); xfs_ialloc_compute_maxlevels(mp); if (sbp->sb_imax_pct) { /* Make sure the maximum inode count is a multiple of the * units we allocate inodes in. */ mp->m_maxicount = (sbp->sb_dblocks * sbp->sb_imax_pct) / 100; mp->m_maxicount = ((mp->m_maxicount / mp->m_ialloc_blks) * mp->m_ialloc_blks) << sbp->sb_inopblog; } else mp->m_maxicount = 0; mp->m_inode_cluster_size = XFS_INODE_BIG_CLUSTER_SIZE; /* * Set whether we're using stripe alignment. */ if (xfs_sb_version_hasdalign(&mp->m_sb)) { mp->m_dalign = sbp->sb_unit; mp->m_swidth = sbp->sb_width; } /* * Set whether we're using inode alignment. */ if (xfs_sb_version_hasalign(&mp->m_sb) && mp->m_sb.sb_inoalignmt >= XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size)) mp->m_inoalign_mask = mp->m_sb.sb_inoalignmt - 1; else mp->m_inoalign_mask = 0; /* * If we are using stripe alignment, check whether * the stripe unit is a multiple of the inode alignment */ if (mp->m_dalign && mp->m_inoalign_mask && !(mp->m_dalign & mp->m_inoalign_mask)) mp->m_sinoalign = mp->m_dalign; else mp->m_sinoalign = 0; /* * Check that the data (and log if separate) are an ok size. */ d = (xfs_daddr_t) XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks); if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) { fprintf(stderr, _("%s: size check failed\n"), progname); if (!(flags & LIBXFS_MOUNT_DEBUGGER)) return NULL; } /* * We automatically convert v1 inodes to v2 inodes now, so if * the NLINK bit is not set we can't operate on the filesystem. */ if (!(sbp->sb_versionnum & XFS_SB_VERSION_NLINKBIT)) { fprintf(stderr, _( "%s: V1 inodes unsupported. Please try an older xfsprogs.\n"), progname); exit(1); } /* Check for supported directory formats */ if (!(sbp->sb_versionnum & XFS_SB_VERSION_DIRV2BIT)) { fprintf(stderr, _( "%s: V1 directories unsupported. Please try an older xfsprogs.\n"), progname); exit(1); } /* check for unsupported other features */ if (!xfs_sb_good_version(sbp)) { fprintf(stderr, _( "%s: Unsupported features detected. Please try a newer xfsprogs.\n"), progname); exit(1); } xfs_da_mount(mp); if (xfs_sb_version_hasattr2(&mp->m_sb)) mp->m_flags |= LIBXFS_MOUNT_ATTR2; /* Initialize the precomputed transaction reservations values */ xfs_trans_init(mp); if (dev == 0) /* maxtrres, we have no device so leave now */ return mp; bp = libxfs_readbuf(mp->m_dev, d - XFS_FSS_TO_BB(mp, 1), XFS_FSS_TO_BB(mp, 1), !(flags & LIBXFS_MOUNT_DEBUGGER), NULL); if (!bp) { fprintf(stderr, _("%s: data size check failed\n"), progname); if (!(flags & LIBXFS_MOUNT_DEBUGGER)) return NULL; } else libxfs_putbuf(bp); if (mp->m_logdev_targp->dev && mp->m_logdev_targp->dev != mp->m_ddev_targp->dev) { d = (xfs_daddr_t) XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks); if ( (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) || (!(bp = libxfs_readbuf(mp->m_logdev_targp, d - XFS_FSB_TO_BB(mp, 1), XFS_FSB_TO_BB(mp, 1), !(flags & LIBXFS_MOUNT_DEBUGGER), NULL))) ) { fprintf(stderr, _("%s: log size checks failed\n"), progname); if (!(flags & LIBXFS_MOUNT_DEBUGGER)) return NULL; } if (bp) libxfs_putbuf(bp); } /* Initialize realtime fields in the mount structure */ if (rtmount_init(mp, flags)) { fprintf(stderr, _("%s: realtime device init failed\n"), progname); return NULL; } error = libxfs_initialize_perag(mp, sbp->sb_agcount, &mp->m_maxagi); if (error) { fprintf(stderr, _("%s: perag init failed\n"), progname); exit(1); } return mp; }
/* * Possible fields that may have been set at mkfs time, * sb_inoalignmt, sb_unit, sb_width and sb_dirblklog. * The quota inode fields in the secondaries should be zero. * Likewise, the sb_flags and sb_shared_vn should also be * zero and the shared version bit should be cleared for * current mkfs's. * * And everything else in the buffer beyond either sb_width, * sb_dirblklog (v2 dirs), or sb_logsectsize can be zeroed. * * Note: contrary to the name, this routine is called for all * superblocks, not just the secondary superblocks. */ static int secondary_sb_wack(xfs_mount_t *mp, xfs_buf_t *sbuf, xfs_sb_t *sb, xfs_agnumber_t i) { int do_bzero; int size; char *ip; int rval; rval = do_bzero = 0; /* * mkfs's that stamped a feature bit besides the ones in the mask * (e.g. were pre-6.5 beta) could leave garbage in the secondary * superblock sectors. Anything stamping the shared fs bit or better * into the secondaries is ok and should generate clean secondary * superblock sectors. so only run the zero check on the * potentially garbaged secondaries. */ if (pre_65_beta || (sb->sb_versionnum & XR_GOOD_SECSB_VNMASK) == 0 || sb->sb_versionnum < XFS_SB_VERSION_4) { /* * Check for garbage beyond the last field. * Use field addresses instead so this code will still * work against older filesystems when the superblock * gets rev'ed again with new fields appended. */ if (xfs_sb_version_hasmorebits(sb)) size = (__psint_t)&sb->sb_features2 + sizeof(sb->sb_features2) - (__psint_t)sb; else if (xfs_sb_version_haslogv2(sb)) size = (__psint_t)&sb->sb_logsunit + sizeof(sb->sb_logsunit) - (__psint_t)sb; else if (xfs_sb_version_hassector(sb)) size = (__psint_t)&sb->sb_logsectsize + sizeof(sb->sb_logsectsize) - (__psint_t)sb; else if (xfs_sb_version_hasdirv2(sb)) size = (__psint_t)&sb->sb_dirblklog + sizeof(sb->sb_dirblklog) - (__psint_t)sb; else size = (__psint_t)&sb->sb_width + sizeof(sb->sb_width) - (__psint_t)sb; for (ip = (char *)((__psint_t)sb + size); ip < (char *)((__psint_t)sb + mp->m_sb.sb_sectsize); ip++) { if (*ip) { do_bzero = 1; break; } } if (do_bzero) { rval |= XR_AG_SB_SEC; if (!no_modify) { do_warn( _("zeroing unused portion of %s superblock (AG #%u)\n"), !i ? _("primary") : _("secondary"), i); memset((void *)((__psint_t)sb + size), 0, mp->m_sb.sb_sectsize - size); } else do_warn( _("would zero unused portion of %s superblock (AG #%u)\n"), !i ? _("primary") : _("secondary"), i); } } /* * now look for the fields we can manipulate directly. * if we did a zero and that zero could have included * the field in question, just silently reset it. otherwise, * complain. * * for now, just zero the flags field since only * the readonly flag is used */ if (sb->sb_flags) { if (!no_modify) sb->sb_flags = 0; if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero) { rval |= XR_AG_SB; do_warn(_("bad flags field in superblock %d\n"), i); } else rval |= XR_AG_SB_SEC; } /* * quota inodes and flags in secondary superblocks * are never set by mkfs. However, they could be set * in a secondary if a fs with quotas was growfs'ed since * growfs copies the new primary into the secondaries. */ if (sb->sb_inprogress == 1 && sb->sb_uquotino) { if (!no_modify) sb->sb_uquotino = 0; if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero) { rval |= XR_AG_SB; do_warn( _("non-null user quota inode field in superblock %d\n"), i); } else rval |= XR_AG_SB_SEC; } if (sb->sb_inprogress == 1 && sb->sb_gquotino) { if (!no_modify) sb->sb_gquotino = 0; if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero) { rval |= XR_AG_SB; do_warn( _("non-null group quota inode field in superblock %d\n"), i); } else rval |= XR_AG_SB_SEC; } if (sb->sb_inprogress == 1 && sb->sb_qflags) { if (!no_modify) sb->sb_qflags = 0; if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero) { rval |= XR_AG_SB; do_warn(_("non-null quota flags in superblock %d\n"), i); } else rval |= XR_AG_SB_SEC; } /* * if the secondaries agree on a stripe unit/width or inode * alignment, those fields ought to be valid since they are * written at mkfs time (and the corresponding sb version bits * are set). */ if (!xfs_sb_version_hasshared(sb) && sb->sb_shared_vn != 0) { if (!no_modify) sb->sb_shared_vn = 0; if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero) { rval |= XR_AG_SB; do_warn( _("bad shared version number in superblock %d\n"), i); } else rval |= XR_AG_SB_SEC; } if (!xfs_sb_version_hasalign(sb) && sb->sb_inoalignmt != 0) { if (!no_modify) sb->sb_inoalignmt = 0; if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero) { rval |= XR_AG_SB; do_warn( _("bad inode alignment field in superblock %d\n"), i); } else rval |= XR_AG_SB_SEC; } if (!xfs_sb_version_hasdalign(sb) && (sb->sb_unit != 0 || sb->sb_width != 0)) { if (!no_modify) sb->sb_unit = sb->sb_width = 0; if (sb->sb_versionnum & XR_GOOD_SECSB_VNMASK || !do_bzero) { rval |= XR_AG_SB; do_warn( _("bad stripe unit/width fields in superblock %d\n"), i); } else rval |= XR_AG_SB_SEC; } if (!xfs_sb_version_hassector(sb) && (sb->sb_sectsize != BBSIZE || sb->sb_sectlog != BBSHIFT || sb->sb_logsectsize != 0 || sb->sb_logsectlog != 0)) { if (!no_modify) { sb->sb_sectsize = BBSIZE; sb->sb_sectlog = BBSHIFT; sb->sb_logsectsize = 0; sb->sb_logsectlog = 0; } if (sb->sb_versionnum & XR_GOOD_SECSB_VNMASK || !do_bzero) { rval |= XR_AG_SB; do_warn( _("bad log/data device sector size fields in superblock %d\n"), i); } else rval |= XR_AG_SB_SEC; } return(rval); }