diff options
author | Chandra Seetharaman <sekharan@us.ibm.com> | 2013-07-19 18:36:02 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-07-22 15:46:26 -0400 |
commit | d892d5864f020c44cfa4e23e9165112d8df91093 (patch) | |
tree | 84abbb176e54b24ff2a13d912d8d82a3b83710af /fs/xfs/xfs_mount.c | |
parent | 0102629776a2f5c3bd9c5dc0ef77956c60255074 (diff) |
xfs: Start using pquotaino from the superblock.
Start using pquotino and define a macro to check if the
superblock has pquotino.
Keep backward compatibilty by alowing mount of older superblock
with no separate pquota inode.
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 62 |
1 files changed, 54 insertions, 8 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 7263e1bb59f7..a0fa8021330d 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -336,14 +336,6 @@ xfs_mount_validate_sb( | |||
336 | return XFS_ERROR(EWRONGFS); | 336 | return XFS_ERROR(EWRONGFS); |
337 | } | 337 | } |
338 | 338 | ||
339 | if ((sbp->sb_qflags & (XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD)) && | ||
340 | (sbp->sb_qflags & (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD | | ||
341 | XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD))) { | ||
342 | xfs_notice(mp, | ||
343 | "Super block has XFS_OQUOTA bits along with XFS_PQUOTA and/or XFS_GQUOTA bits.\n"); | ||
344 | return XFS_ERROR(EFSCORRUPTED); | ||
345 | } | ||
346 | |||
347 | /* | 339 | /* |
348 | * Version 5 superblock feature mask validation. Reject combinations the | 340 | * Version 5 superblock feature mask validation. Reject combinations the |
349 | * kernel cannot support up front before checking anything else. For | 341 | * kernel cannot support up front before checking anything else. For |
@@ -387,6 +379,19 @@ xfs_mount_validate_sb( | |||
387 | } | 379 | } |
388 | } | 380 | } |
389 | 381 | ||
382 | if (xfs_sb_version_has_pquotino(sbp)) { | ||
383 | if (sbp->sb_qflags & (XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD)) { | ||
384 | xfs_notice(mp, | ||
385 | "Version 5 of Super block has XFS_OQUOTA bits.\n"); | ||
386 | return XFS_ERROR(EFSCORRUPTED); | ||
387 | } | ||
388 | } else if (sbp->sb_qflags & (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD | | ||
389 | XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) { | ||
390 | xfs_notice(mp, | ||
391 | "Superblock earlier than Version 5 has XFS_[PQ]UOTA_{ENFD|CHKD} bits.\n"); | ||
392 | return XFS_ERROR(EFSCORRUPTED); | ||
393 | } | ||
394 | |||
390 | if (unlikely( | 395 | if (unlikely( |
391 | sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) { | 396 | sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) { |
392 | xfs_warn(mp, | 397 | xfs_warn(mp, |
@@ -590,6 +595,13 @@ xfs_sb_quota_from_disk(struct xfs_sb *sbp) | |||
590 | if (sbp->sb_pquotino == 0) | 595 | if (sbp->sb_pquotino == 0) |
591 | sbp->sb_pquotino = NULLFSINO; | 596 | sbp->sb_pquotino = NULLFSINO; |
592 | 597 | ||
598 | /* | ||
599 | * We need to do these manipilations only if we are working | ||
600 | * with an older version of on-disk superblock. | ||
601 | */ | ||
602 | if (xfs_sb_version_has_pquotino(sbp)) | ||
603 | return; | ||
604 | |||
593 | if (sbp->sb_qflags & XFS_OQUOTA_ENFD) | 605 | if (sbp->sb_qflags & XFS_OQUOTA_ENFD) |
594 | sbp->sb_qflags |= (sbp->sb_qflags & XFS_PQUOTA_ACCT) ? | 606 | sbp->sb_qflags |= (sbp->sb_qflags & XFS_PQUOTA_ACCT) ? |
595 | XFS_PQUOTA_ENFD : XFS_GQUOTA_ENFD; | 607 | XFS_PQUOTA_ENFD : XFS_GQUOTA_ENFD; |
@@ -597,6 +609,18 @@ xfs_sb_quota_from_disk(struct xfs_sb *sbp) | |||
597 | sbp->sb_qflags |= (sbp->sb_qflags & XFS_PQUOTA_ACCT) ? | 609 | sbp->sb_qflags |= (sbp->sb_qflags & XFS_PQUOTA_ACCT) ? |
598 | XFS_PQUOTA_CHKD : XFS_GQUOTA_CHKD; | 610 | XFS_PQUOTA_CHKD : XFS_GQUOTA_CHKD; |
599 | sbp->sb_qflags &= ~(XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD); | 611 | sbp->sb_qflags &= ~(XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD); |
612 | |||
613 | if (sbp->sb_qflags & XFS_PQUOTA_ACCT) { | ||
614 | /* | ||
615 | * In older version of superblock, on-disk superblock only | ||
616 | * has sb_gquotino, and in-core superblock has both sb_gquotino | ||
617 | * and sb_pquotino. But, only one of them is supported at any | ||
618 | * point of time. So, if PQUOTA is set in disk superblock, | ||
619 | * copy over sb_gquotino to sb_pquotino. | ||
620 | */ | ||
621 | sbp->sb_pquotino = sbp->sb_gquotino; | ||
622 | sbp->sb_gquotino = NULLFSINO; | ||
623 | } | ||
600 | } | 624 | } |
601 | 625 | ||
602 | void | 626 | void |
@@ -668,6 +692,13 @@ xfs_sb_quota_to_disk( | |||
668 | { | 692 | { |
669 | __uint16_t qflags = from->sb_qflags; | 693 | __uint16_t qflags = from->sb_qflags; |
670 | 694 | ||
695 | /* | ||
696 | * We need to do these manipilations only if we are working | ||
697 | * with an older version of on-disk superblock. | ||
698 | */ | ||
699 | if (xfs_sb_version_has_pquotino(from)) | ||
700 | return; | ||
701 | |||
671 | if (*fields & XFS_SB_QFLAGS) { | 702 | if (*fields & XFS_SB_QFLAGS) { |
672 | /* | 703 | /* |
673 | * The in-core version of sb_qflags do not have | 704 | * The in-core version of sb_qflags do not have |
@@ -687,6 +718,21 @@ xfs_sb_quota_to_disk( | |||
687 | to->sb_qflags = cpu_to_be16(qflags); | 718 | to->sb_qflags = cpu_to_be16(qflags); |
688 | *fields &= ~XFS_SB_QFLAGS; | 719 | *fields &= ~XFS_SB_QFLAGS; |
689 | } | 720 | } |
721 | |||
722 | /* | ||
723 | * GQUOTINO and PQUOTINO cannot be used together in versions | ||
724 | * of superblock that do not have pquotino. from->sb_flags | ||
725 | * tells us which quota is active and should be copied to | ||
726 | * disk. | ||
727 | */ | ||
728 | if ((*fields & XFS_SB_GQUOTINO) && | ||
729 | (from->sb_qflags & XFS_GQUOTA_ACCT)) | ||
730 | to->sb_gquotino = cpu_to_be64(from->sb_gquotino); | ||
731 | else if ((*fields & XFS_SB_PQUOTINO) && | ||
732 | (from->sb_qflags & XFS_PQUOTA_ACCT)) | ||
733 | to->sb_gquotino = cpu_to_be64(from->sb_pquotino); | ||
734 | |||
735 | *fields &= ~(XFS_SB_PQUOTINO | XFS_SB_GQUOTINO); | ||
690 | } | 736 | } |
691 | 737 | ||
692 | /* | 738 | /* |