diff options
author | Chandra Seetharaman <sekharan@us.ibm.com> | 2013-06-27 18:25:10 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-06-28 18:39:22 -0400 |
commit | 83e782e1a1cc0159888e58e14dfc8f3289663338 (patch) | |
tree | 82d328c90f3d3c89a7011f554e0bb8871dbdee8e /fs/xfs/xfs_mount.c | |
parent | 0e6436d99e730f9384f3c11d24a5efb788885fc6 (diff) |
xfs: Remove incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD
Remove all incore use of XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD. Instead,
start using XFS_GQUOTA_.* XFS_PQUOTA_.* counterparts for GQUOTA and
PQUOTA respectively.
On-disk copy still uses XFS_OQUOTA_ENFD and XFS_OQUOTA_CHKD.
Read and write of the superblock does the conversion from *OQUOTA*
to *[PG]QUOTA*.
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 | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 2978bb4cc72a..2b0ba3581656 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -336,6 +336,14 @@ 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 | |||
339 | /* | 347 | /* |
340 | * Version 5 superblock feature mask validation. Reject combinations the | 348 | * Version 5 superblock feature mask validation. Reject combinations the |
341 | * kernel cannot support up front before checking anything else. For | 349 | * kernel cannot support up front before checking anything else. For |
@@ -561,6 +569,18 @@ out_unwind: | |||
561 | return error; | 569 | return error; |
562 | } | 570 | } |
563 | 571 | ||
572 | static void | ||
573 | xfs_sb_quota_from_disk(struct xfs_sb *sbp) | ||
574 | { | ||
575 | if (sbp->sb_qflags & XFS_OQUOTA_ENFD) | ||
576 | sbp->sb_qflags |= (sbp->sb_qflags & XFS_PQUOTA_ACCT) ? | ||
577 | XFS_PQUOTA_ENFD : XFS_GQUOTA_ENFD; | ||
578 | if (sbp->sb_qflags & XFS_OQUOTA_CHKD) | ||
579 | sbp->sb_qflags |= (sbp->sb_qflags & XFS_PQUOTA_ACCT) ? | ||
580 | XFS_PQUOTA_CHKD : XFS_GQUOTA_CHKD; | ||
581 | sbp->sb_qflags &= ~(XFS_OQUOTA_ENFD | XFS_OQUOTA_CHKD); | ||
582 | } | ||
583 | |||
564 | void | 584 | void |
565 | xfs_sb_from_disk( | 585 | xfs_sb_from_disk( |
566 | struct xfs_sb *to, | 586 | struct xfs_sb *to, |
@@ -622,6 +642,35 @@ xfs_sb_from_disk( | |||
622 | to->sb_lsn = be64_to_cpu(from->sb_lsn); | 642 | to->sb_lsn = be64_to_cpu(from->sb_lsn); |
623 | } | 643 | } |
624 | 644 | ||
645 | static inline void | ||
646 | xfs_sb_quota_to_disk( | ||
647 | xfs_dsb_t *to, | ||
648 | xfs_sb_t *from, | ||
649 | __int64_t *fields) | ||
650 | { | ||
651 | __uint16_t qflags = from->sb_qflags; | ||
652 | |||
653 | if (*fields & XFS_SB_QFLAGS) { | ||
654 | /* | ||
655 | * The in-core version of sb_qflags do not have | ||
656 | * XFS_OQUOTA_* flags, whereas the on-disk version | ||
657 | * does. So, convert incore XFS_{PG}QUOTA_* flags | ||
658 | * to on-disk XFS_OQUOTA_* flags. | ||
659 | */ | ||
660 | qflags &= ~(XFS_PQUOTA_ENFD | XFS_PQUOTA_CHKD | | ||
661 | XFS_GQUOTA_ENFD | XFS_GQUOTA_CHKD); | ||
662 | |||
663 | if (from->sb_qflags & | ||
664 | (XFS_PQUOTA_ENFD | XFS_GQUOTA_ENFD)) | ||
665 | qflags |= XFS_OQUOTA_ENFD; | ||
666 | if (from->sb_qflags & | ||
667 | (XFS_PQUOTA_CHKD | XFS_GQUOTA_CHKD)) | ||
668 | qflags |= XFS_OQUOTA_CHKD; | ||
669 | to->sb_qflags = cpu_to_be16(qflags); | ||
670 | *fields &= ~XFS_SB_QFLAGS; | ||
671 | } | ||
672 | } | ||
673 | |||
625 | /* | 674 | /* |
626 | * Copy in core superblock to ondisk one. | 675 | * Copy in core superblock to ondisk one. |
627 | * | 676 | * |
@@ -643,6 +692,7 @@ xfs_sb_to_disk( | |||
643 | if (!fields) | 692 | if (!fields) |
644 | return; | 693 | return; |
645 | 694 | ||
695 | xfs_sb_quota_to_disk(to, from, &fields); | ||
646 | while (fields) { | 696 | while (fields) { |
647 | f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields); | 697 | f = (xfs_sb_field_t)xfs_lowbit64((__uint64_t)fields); |
648 | first = xfs_sb_info[f].offset; | 698 | first = xfs_sb_info[f].offset; |
@@ -835,6 +885,7 @@ reread: | |||
835 | */ | 885 | */ |
836 | xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp)); | 886 | xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp)); |
837 | 887 | ||
888 | xfs_sb_quota_from_disk(&mp->m_sb); | ||
838 | /* | 889 | /* |
839 | * We must be able to do sector-sized and sector-aligned IO. | 890 | * We must be able to do sector-sized and sector-aligned IO. |
840 | */ | 891 | */ |