/* xfs_sb.h */
#define libxfs_mod_sb xfs_mod_sb
#define libxfs_sb_from_disk xfs_sb_from_disk
+#define libxfs_sb_quota_from_disk xfs_sb_quota_from_disk
#define libxfs_sb_to_disk xfs_sb_to_disk
/* xfs_symlink.h */
}
#ifdef IO_DEBUG
- printf("%lx: %s: wrote %u bytes, blkno=%llu(%llu), %p\n",
+ printf("%lx: %s: wrote %u bytes, blkno=%llu(%llu), %p, error %d\n",
pthread_self(), __FUNCTION__, bp->b_bcount,
(long long)LIBXFS_BBTOOFF64(bp->b_bn),
- (long long)bp->b_bn, bp);
+ (long long)bp->b_bn, bp, error);
#endif
if (!error) {
bp->b_flags |= LIBXFS_B_UPTODATE;
* 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)
+secondary_sb_wack(
+ struct xfs_mount *mp,
+ struct xfs_buf *sbuf,
+ struct xfs_sb *sb,
+ xfs_agnumber_t i)
{
- int do_bzero;
- int size;
- char *ip;
- int rval;
+ struct xfs_dsb *dsb = XFS_BUF_TO_SBP(sbuf);
+ int do_bzero = 0;
+ int size;
+ char *ip;
+ int rval = 0;;
rval = do_bzero = 0;
}
/*
- * 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.
+ * 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.
+ *
+ * Also, the in-core inode flags now have different meaning to the
+ * on-disk flags, and so libxfs_sb_to_disk cannot directly write the
+ * sb_gquotino/sb_pquotino fields without specific sb_qflags being set.
+ * Hence we need to zero those fields directly in the sb buffer here.
*/
- if (sb->sb_inprogress == 1 && sb->sb_uquotino) {
+
+ if (sb->sb_inprogress == 1 && sb->sb_uquotino != NULLFSINO) {
if (!no_modify)
sb->sb_uquotino = 0;
if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero) {
rval |= XR_AG_SB_SEC;
}
- if (sb->sb_inprogress == 1 && sb->sb_gquotino) {
- if (!no_modify)
+ if (sb->sb_inprogress == 1 && sb->sb_gquotino != NULLFSINO) {
+ if (!no_modify) {
sb->sb_gquotino = 0;
+ dsb->sb_gquotino = 0;
+ }
if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero) {
rval |= XR_AG_SB;
do_warn(
rval |= XR_AG_SB_SEC;
}
- if (sb->sb_inprogress == 1 && sb->sb_pquotino) {
- if (!no_modify)
+ if (sb->sb_inprogress == 1 && sb->sb_pquotino != NULLFSINO) {
+ if (!no_modify) {
sb->sb_pquotino = 0;
+ dsb->sb_pquotino = 0;
+ }
if (sb->sb_versionnum & XR_PART_SECSB_VNMASK || !do_bzero) {
rval |= XR_AG_SB;
do_warn(
for (i = 0; !done && i < bsize; i += BBSIZE) {
c_bufsb = (char *)sb + i;
libxfs_sb_from_disk(&bufsb, (xfs_dsb_t *)c_bufsb);
+ libxfs_sb_quota_from_disk(&bufsb);
if (verify_sb(c_bufsb, &bufsb, 0) != XR_OK)
continue;
do_error("%s\n", strerror(error));
}
libxfs_sb_from_disk(sbp, buf);
+ libxfs_sb_quota_from_disk(sbp);
rval = verify_sb((char *)buf, sbp, agno == 0);
free(buf);
goto out_free_sb;
}
libxfs_sb_from_disk(sb, XFS_BUF_TO_SBP(sbbuf));
+ libxfs_sb_quota_from_disk(sb);
agfbuf = libxfs_readbuf(mp->m_dev,
XFS_AG_DADDR(mp, agno, XFS_AGF_DADDR(mp)),