diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-08-30 03:19:57 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 21:43:26 -0400 |
commit | b09cc77109dbf33463480952de10511a2b67bba6 (patch) | |
tree | 722ed205af03de0f33b955aeb3a573565242497a /fs/xfs/xfs_vfsops.c | |
parent | 293688ec420f1160ed93ea4c7948ed5baf8bafa7 (diff) |
[XFS] remove dependency of the quota module on behaviors
Mount options are now parsed by the main XFS module and rejected if quota
support is not available, and there are some new quota operation for the
quotactl syscall and calls to quote in the mount, unmount and sync
callchains.
SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29503a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_vfsops.c')
-rw-r--r-- | fs/xfs/xfs_vfsops.c | 110 |
1 files changed, 107 insertions, 3 deletions
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index 1cf8f54d8aa9..f62f6e486f23 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
@@ -402,6 +402,22 @@ xfs_finish_flags( | |||
402 | return XFS_ERROR(EINVAL); | 402 | return XFS_ERROR(EINVAL); |
403 | } | 403 | } |
404 | 404 | ||
405 | if (ap->flags & XFSMNT_UQUOTA) { | ||
406 | mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE); | ||
407 | if (ap->flags & XFSMNT_UQUOTAENF) | ||
408 | mp->m_qflags |= XFS_UQUOTA_ENFD; | ||
409 | } | ||
410 | |||
411 | if (ap->flags & XFSMNT_GQUOTA) { | ||
412 | mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE); | ||
413 | if (ap->flags & XFSMNT_GQUOTAENF) | ||
414 | mp->m_qflags |= XFS_OQUOTA_ENFD; | ||
415 | } else if (ap->flags & XFSMNT_PQUOTA) { | ||
416 | mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE); | ||
417 | if (ap->flags & XFSMNT_PQUOTAENF) | ||
418 | mp->m_qflags |= XFS_OQUOTA_ENFD; | ||
419 | } | ||
420 | |||
405 | return 0; | 421 | return 0; |
406 | } | 422 | } |
407 | 423 | ||
@@ -435,12 +451,13 @@ xfs_mount( | |||
435 | error = xfs_dmops_get(mp, args); | 451 | error = xfs_dmops_get(mp, args); |
436 | if (error) | 452 | if (error) |
437 | return error; | 453 | return error; |
454 | error = xfs_qmops_get(mp, args); | ||
455 | if (error) | ||
456 | return error; | ||
438 | 457 | ||
439 | /* | 458 | /* |
440 | * Setup xfs_mount function vectors from available behaviors | 459 | * Setup xfs_mount function vectors from available behaviors |
441 | */ | 460 | */ |
442 | p = vfs_bhv_lookup(vfsp, VFS_POSITION_QM); | ||
443 | mp->m_qm_ops = p ? *(xfs_qmops_t *) vfs_bhv_custom(p) : xfs_qmcore_stub; | ||
444 | p = vfs_bhv_lookup(vfsp, VFS_POSITION_IO); | 461 | p = vfs_bhv_lookup(vfsp, VFS_POSITION_IO); |
445 | mp->m_io_ops = p ? *(xfs_ioops_t *) vfs_bhv_custom(p) : xfs_iocore_xfs; | 462 | mp->m_io_ops = p ? *(xfs_ioops_t *) vfs_bhv_custom(p) : xfs_iocore_xfs; |
446 | 463 | ||
@@ -556,6 +573,7 @@ error1: | |||
556 | xfs_binval(mp->m_rtdev_targp); | 573 | xfs_binval(mp->m_rtdev_targp); |
557 | error0: | 574 | error0: |
558 | xfs_unmountfs_close(mp, credp); | 575 | xfs_unmountfs_close(mp, credp); |
576 | xfs_qmops_put(mp); | ||
559 | xfs_dmops_put(mp); | 577 | xfs_dmops_put(mp); |
560 | return error; | 578 | return error; |
561 | } | 579 | } |
@@ -647,6 +665,7 @@ out: | |||
647 | * and free the super block buffer & mount structures. | 665 | * and free the super block buffer & mount structures. |
648 | */ | 666 | */ |
649 | xfs_unmountfs(mp, credp); | 667 | xfs_unmountfs(mp, credp); |
668 | xfs_qmops_put(mp); | ||
650 | xfs_dmops_put(mp); | 669 | xfs_dmops_put(mp); |
651 | kmem_free(mp, sizeof(xfs_mount_t)); | 670 | kmem_free(mp, sizeof(xfs_mount_t)); |
652 | } | 671 | } |
@@ -887,6 +906,8 @@ xfs_statvfs( | |||
887 | xfs_statvfs_fsid(statp, mp); | 906 | xfs_statvfs_fsid(statp, mp); |
888 | statp->f_namelen = MAXNAMELEN - 1; | 907 | statp->f_namelen = MAXNAMELEN - 1; |
889 | 908 | ||
909 | if (vp) | ||
910 | XFS_QM_DQSTATVFS(xfs_vtoi(vp), statp); | ||
890 | return 0; | 911 | return 0; |
891 | } | 912 | } |
892 | 913 | ||
@@ -941,6 +962,25 @@ xfs_sync( | |||
941 | cred_t *credp) | 962 | cred_t *credp) |
942 | { | 963 | { |
943 | xfs_mount_t *mp = XFS_BHVTOM(bdp); | 964 | xfs_mount_t *mp = XFS_BHVTOM(bdp); |
965 | int error; | ||
966 | |||
967 | /* | ||
968 | * Get the Quota Manager to flush the dquots. | ||
969 | * | ||
970 | * If XFS quota support is not enabled or this filesystem | ||
971 | * instance does not use quotas XFS_QM_DQSYNC will always | ||
972 | * return zero. | ||
973 | */ | ||
974 | error = XFS_QM_DQSYNC(mp, flags); | ||
975 | if (error) { | ||
976 | /* | ||
977 | * If we got an IO error, we will be shutting down. | ||
978 | * So, there's nothing more for us to do here. | ||
979 | */ | ||
980 | ASSERT(error != EIO || XFS_FORCED_SHUTDOWN(mp)); | ||
981 | if (XFS_FORCED_SHUTDOWN(mp)) | ||
982 | return XFS_ERROR(error); | ||
983 | } | ||
944 | 984 | ||
945 | if (flags & SYNC_IOWAIT) | 985 | if (flags & SYNC_IOWAIT) |
946 | xfs_filestream_flush(mp); | 986 | xfs_filestream_flush(mp); |
@@ -1696,6 +1736,18 @@ xfs_vget( | |||
1696 | #define MNTOPT_ATTR2 "attr2" /* do use attr2 attribute format */ | 1736 | #define MNTOPT_ATTR2 "attr2" /* do use attr2 attribute format */ |
1697 | #define MNTOPT_NOATTR2 "noattr2" /* do not use attr2 attribute format */ | 1737 | #define MNTOPT_NOATTR2 "noattr2" /* do not use attr2 attribute format */ |
1698 | #define MNTOPT_FILESTREAM "filestreams" /* use filestreams allocator */ | 1738 | #define MNTOPT_FILESTREAM "filestreams" /* use filestreams allocator */ |
1739 | #define MNTOPT_QUOTA "quota" /* disk quotas (user) */ | ||
1740 | #define MNTOPT_NOQUOTA "noquota" /* no quotas */ | ||
1741 | #define MNTOPT_USRQUOTA "usrquota" /* user quota enabled */ | ||
1742 | #define MNTOPT_GRPQUOTA "grpquota" /* group quota enabled */ | ||
1743 | #define MNTOPT_PRJQUOTA "prjquota" /* project quota enabled */ | ||
1744 | #define MNTOPT_UQUOTA "uquota" /* user quota (IRIX variant) */ | ||
1745 | #define MNTOPT_GQUOTA "gquota" /* group quota (IRIX variant) */ | ||
1746 | #define MNTOPT_PQUOTA "pquota" /* project quota (IRIX variant) */ | ||
1747 | #define MNTOPT_UQUOTANOENF "uqnoenforce"/* user quota limit enforcement */ | ||
1748 | #define MNTOPT_GQUOTANOENF "gqnoenforce"/* group quota limit enforcement */ | ||
1749 | #define MNTOPT_PQUOTANOENF "pqnoenforce"/* project quota limit enforcement */ | ||
1750 | #define MNTOPT_QUOTANOENF "qnoenforce" /* same as uqnoenforce */ | ||
1699 | #define MNTOPT_DMAPI "dmapi" /* DMI enabled (DMAPI / XDSM) */ | 1751 | #define MNTOPT_DMAPI "dmapi" /* DMI enabled (DMAPI / XDSM) */ |
1700 | #define MNTOPT_XDSM "xdsm" /* DMI enabled (DMAPI / XDSM) */ | 1752 | #define MNTOPT_XDSM "xdsm" /* DMI enabled (DMAPI / XDSM) */ |
1701 | #define MNTOPT_DMI "dmi" /* DMI enabled (DMAPI / XDSM) */ | 1753 | #define MNTOPT_DMI "dmi" /* DMI enabled (DMAPI / XDSM) */ |
@@ -1889,6 +1941,29 @@ xfs_parseargs( | |||
1889 | args->flags &= ~XFSMNT_ATTR2; | 1941 | args->flags &= ~XFSMNT_ATTR2; |
1890 | } else if (!strcmp(this_char, MNTOPT_FILESTREAM)) { | 1942 | } else if (!strcmp(this_char, MNTOPT_FILESTREAM)) { |
1891 | args->flags2 |= XFSMNT2_FILESTREAMS; | 1943 | args->flags2 |= XFSMNT2_FILESTREAMS; |
1944 | } else if (!strcmp(this_char, MNTOPT_NOQUOTA)) { | ||
1945 | args->flags &= ~(XFSMNT_UQUOTAENF|XFSMNT_UQUOTA); | ||
1946 | args->flags &= ~(XFSMNT_GQUOTAENF|XFSMNT_GQUOTA); | ||
1947 | } else if (!strcmp(this_char, MNTOPT_QUOTA) || | ||
1948 | !strcmp(this_char, MNTOPT_UQUOTA) || | ||
1949 | !strcmp(this_char, MNTOPT_USRQUOTA)) { | ||
1950 | args->flags |= XFSMNT_UQUOTA | XFSMNT_UQUOTAENF; | ||
1951 | } else if (!strcmp(this_char, MNTOPT_QUOTANOENF) || | ||
1952 | !strcmp(this_char, MNTOPT_UQUOTANOENF)) { | ||
1953 | args->flags |= XFSMNT_UQUOTA; | ||
1954 | args->flags &= ~XFSMNT_UQUOTAENF; | ||
1955 | } else if (!strcmp(this_char, MNTOPT_PQUOTA) || | ||
1956 | !strcmp(this_char, MNTOPT_PRJQUOTA)) { | ||
1957 | args->flags |= XFSMNT_PQUOTA | XFSMNT_PQUOTAENF; | ||
1958 | } else if (!strcmp(this_char, MNTOPT_PQUOTANOENF)) { | ||
1959 | args->flags |= XFSMNT_PQUOTA; | ||
1960 | args->flags &= ~XFSMNT_PQUOTAENF; | ||
1961 | } else if (!strcmp(this_char, MNTOPT_GQUOTA) || | ||
1962 | !strcmp(this_char, MNTOPT_GRPQUOTA)) { | ||
1963 | args->flags |= XFSMNT_GQUOTA | XFSMNT_GQUOTAENF; | ||
1964 | } else if (!strcmp(this_char, MNTOPT_GQUOTANOENF)) { | ||
1965 | args->flags |= XFSMNT_GQUOTA; | ||
1966 | args->flags &= ~XFSMNT_GQUOTAENF; | ||
1892 | } else if (!strcmp(this_char, MNTOPT_DMAPI)) { | 1967 | } else if (!strcmp(this_char, MNTOPT_DMAPI)) { |
1893 | args->flags |= XFSMNT_DMAPI; | 1968 | args->flags |= XFSMNT_DMAPI; |
1894 | } else if (!strcmp(this_char, MNTOPT_XDSM)) { | 1969 | } else if (!strcmp(this_char, MNTOPT_XDSM)) { |
@@ -1926,6 +2001,12 @@ xfs_parseargs( | |||
1926 | return EINVAL; | 2001 | return EINVAL; |
1927 | } | 2002 | } |
1928 | 2003 | ||
2004 | if ((args->flags & XFSMNT_GQUOTA) && (args->flags & XFSMNT_PQUOTA)) { | ||
2005 | cmn_err(CE_WARN, | ||
2006 | "XFS: cannot mount with both project and group quota"); | ||
2007 | return EINVAL; | ||
2008 | } | ||
2009 | |||
1929 | if ((args->flags & XFSMNT_DMAPI) && *args->mtpt == '\0') { | 2010 | if ((args->flags & XFSMNT_DMAPI) && *args->mtpt == '\0') { |
1930 | printk("XFS: %s option needs the mount point option as well\n", | 2011 | printk("XFS: %s option needs the mount point option as well\n", |
1931 | MNTOPT_DMAPI); | 2012 | MNTOPT_DMAPI); |
@@ -2025,9 +2106,32 @@ xfs_showargs( | |||
2025 | if (vfsp->vfs_flag & VFS_GRPID) | 2106 | if (vfsp->vfs_flag & VFS_GRPID) |
2026 | seq_printf(m, "," MNTOPT_GRPID); | 2107 | seq_printf(m, "," MNTOPT_GRPID); |
2027 | 2108 | ||
2109 | if (mp->m_qflags & XFS_UQUOTA_ACCT) { | ||
2110 | if (mp->m_qflags & XFS_UQUOTA_ENFD) | ||
2111 | seq_puts(m, "," MNTOPT_USRQUOTA); | ||
2112 | else | ||
2113 | seq_puts(m, "," MNTOPT_UQUOTANOENF); | ||
2114 | } | ||
2115 | |||
2116 | if (mp->m_qflags & XFS_PQUOTA_ACCT) { | ||
2117 | if (mp->m_qflags & XFS_OQUOTA_ENFD) | ||
2118 | seq_puts(m, "," MNTOPT_PRJQUOTA); | ||
2119 | else | ||
2120 | seq_puts(m, "," MNTOPT_PQUOTANOENF); | ||
2121 | } | ||
2122 | |||
2123 | if (mp->m_qflags & XFS_GQUOTA_ACCT) { | ||
2124 | if (mp->m_qflags & XFS_OQUOTA_ENFD) | ||
2125 | seq_puts(m, "," MNTOPT_GRPQUOTA); | ||
2126 | else | ||
2127 | seq_puts(m, "," MNTOPT_GQUOTANOENF); | ||
2128 | } | ||
2129 | |||
2130 | if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT)) | ||
2131 | seq_puts(m, "," MNTOPT_NOQUOTA); | ||
2132 | |||
2028 | if (vfsp->vfs_flag & VFS_DMI) | 2133 | if (vfsp->vfs_flag & VFS_DMI) |
2029 | seq_puts(m, "," MNTOPT_DMAPI); | 2134 | seq_puts(m, "," MNTOPT_DMAPI); |
2030 | |||
2031 | return 0; | 2135 | return 0; |
2032 | } | 2136 | } |
2033 | 2137 | ||