]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/xfs/quota/xfs_qm_syscalls.c
[ARM] 4863/1: AT91: CAP9 USART definitions for early debug
[linux-2.6-omap-h63xx.git] / fs / xfs / quota / xfs_qm_syscalls.c
index ed620c4d15941396e5bec0cc27cb0628a0b7dbc6..2cc5886cfe85e232374f67bf84620b564d9bbc42 100644 (file)
@@ -46,8 +46,6 @@
 #include "xfs_error.h"
 #include "xfs_rw.h"
 #include "xfs_acl.h"
-#include "xfs_cap.h"
-#include "xfs_mac.h"
 #include "xfs_attr.h"
 #include "xfs_buf_item.h"
 #include "xfs_utils.h"
@@ -83,18 +81,13 @@ STATIC void xfs_qm_export_dquot(xfs_mount_t *, xfs_disk_dquot_t *,
  */
 int
 xfs_qm_quotactl(
-       struct bhv_desc *bdp,
+       xfs_mount_t     *mp,
        int             cmd,
        int             id,
        xfs_caddr_t     addr)
 {
-       xfs_mount_t     *mp;
-       bhv_vfs_t       *vfsp;
        int             error;
 
-       vfsp = bhvtovfs(bdp);
-       mp = XFS_VFSTOM(vfsp);
-
        ASSERT(addr != NULL || cmd == Q_XQUOTASYNC);
 
        /*
@@ -107,7 +100,7 @@ xfs_qm_quotactl(
                 */
                if (XFS_IS_QUOTA_ON(mp))
                        return XFS_ERROR(EINVAL);
-               if (vfsp->vfs_flag & VFS_RDONLY)
+               if (mp->m_flags & XFS_MOUNT_RDONLY)
                        return XFS_ERROR(EROFS);
                return (xfs_qm_scall_trunc_qfiles(mp,
                               xfs_qm_import_qtype_flags(*(uint *)addr)));
@@ -123,18 +116,18 @@ xfs_qm_quotactl(
                 * QUOTAON - enabling quota enforcement.
                 * Quota accounting must be turned on at mount time.
                 */
-               if (vfsp->vfs_flag & VFS_RDONLY)
+               if (mp->m_flags & XFS_MOUNT_RDONLY)
                        return XFS_ERROR(EROFS);
                return (xfs_qm_scall_quotaon(mp,
                                          xfs_qm_import_flags(*(uint *)addr)));
 
        case Q_XQUOTAOFF:
-               if (vfsp->vfs_flag & VFS_RDONLY)
+               if (mp->m_flags & XFS_MOUNT_RDONLY)
                        return XFS_ERROR(EROFS);
                break;
 
        case Q_XQUOTASYNC:
-               return (xfs_sync_inodes(mp, SYNC_DELWRI, 0, NULL));
+               return (xfs_sync_inodes(mp, SYNC_DELWRI, NULL));
 
        default:
                break;
@@ -145,7 +138,7 @@ xfs_qm_quotactl(
 
        switch (cmd) {
        case Q_XQUOTAOFF:
-               if (vfsp->vfs_flag & VFS_RDONLY)
+               if (mp->m_flags & XFS_MOUNT_RDONLY)
                        return XFS_ERROR(EROFS);
                error = xfs_qm_scall_quotaoff(mp,
                                            xfs_qm_import_flags(*(uint *)addr),
@@ -166,19 +159,19 @@ xfs_qm_quotactl(
                break;
 
        case Q_XSETQLIM:
-               if (vfsp->vfs_flag & VFS_RDONLY)
+               if (mp->m_flags & XFS_MOUNT_RDONLY)
                        return XFS_ERROR(EROFS);
                error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER,
                                             (fs_disk_quota_t *)addr);
                break;
        case Q_XSETGQLIM:
-               if (vfsp->vfs_flag & VFS_RDONLY)
+               if (mp->m_flags & XFS_MOUNT_RDONLY)
                        return XFS_ERROR(EROFS);
                error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP,
                                             (fs_disk_quota_t *)addr);
                break;
        case Q_XSETPQLIM:
-               if (vfsp->vfs_flag & VFS_RDONLY)
+               if (mp->m_flags & XFS_MOUNT_RDONLY)
                        return XFS_ERROR(EROFS);
                error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_PROJ,
                                             (fs_disk_quota_t *)addr);
@@ -207,7 +200,6 @@ xfs_qm_scall_quotaoff(
        boolean_t               force)
 {
        uint                    dqtype;
-       unsigned long   s;
        int                     error;
        uint                    inactivate_flags;
        xfs_qoff_logitem_t      *qoffstart;
@@ -244,9 +236,9 @@ xfs_qm_scall_quotaoff(
        if ((flags & XFS_ALL_QUOTA_ACCT) == 0) {
                mp->m_qflags &= ~(flags);
 
-               s = XFS_SB_LOCK(mp);
+               spin_lock(&mp->m_sb_lock);
                mp->m_sb.sb_qflags = mp->m_qflags;
-               XFS_SB_UNLOCK(mp, s);
+               spin_unlock(&mp->m_sb_lock);
                mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
 
                /* XXX what to do if error ? Revert back to old vals incore ? */
@@ -422,7 +414,6 @@ xfs_qm_scall_quotaon(
        uint            flags)
 {
        int             error;
-       unsigned long   s;
        uint            qf;
        uint            accflags;
        __int64_t       sbflags;
@@ -458,9 +449,7 @@ xfs_qm_scall_quotaon(
            ||
            ((flags & XFS_PQUOTA_ACCT) == 0 &&
            (mp->m_sb.sb_qflags & XFS_PQUOTA_ACCT) == 0 &&
-           (flags & XFS_OQUOTA_ENFD))
-           ||
-           ((flags & XFS_GQUOTA_ACCT) == 0 &&
+           (flags & XFS_GQUOTA_ACCT) == 0 &&
            (mp->m_sb.sb_qflags & XFS_GQUOTA_ACCT) == 0 &&
            (flags & XFS_OQUOTA_ENFD))) {
                qdprintk("Can't enforce without acct, flags=%x sbflags=%x\n",
@@ -477,10 +466,10 @@ xfs_qm_scall_quotaon(
         * Change sb_qflags on disk but not incore mp->qflags
         * if this is the root filesystem.
         */
-       s = XFS_SB_LOCK(mp);
+       spin_lock(&mp->m_sb_lock);
        qf = mp->m_sb.sb_qflags;
        mp->m_sb.sb_qflags = qf | flags;
-       XFS_SB_UNLOCK(mp, s);
+       spin_unlock(&mp->m_sb_lock);
 
        /*
         * There's nothing to change if it's the same.
@@ -737,7 +726,7 @@ xfs_qm_scall_setqlim(
        xfs_trans_log_dquot(tp, dqp);
 
        xfs_dqtrace_entry(dqp, "Q_SETQLIM: COMMIT");
-       xfs_trans_commit(tp, 0, NULL);
+       xfs_trans_commit(tp, 0);
        xfs_qm_dqprint(dqp);
        xfs_qm_dqrele(dqp);
        mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
@@ -811,7 +800,7 @@ xfs_qm_log_quotaoff_end(
         * We don't care about quotoff's performance.
         */
        xfs_trans_set_sync(tp);
-       error = xfs_trans_commit(tp, 0, NULL);
+       error = xfs_trans_commit(tp, 0);
        return (error);
 }
 
@@ -824,7 +813,6 @@ xfs_qm_log_quotaoff(
 {
        xfs_trans_t            *tp;
        int                     error;
-       unsigned long   s;
        xfs_qoff_logitem_t     *qoffi=NULL;
        uint                    oldsbqflag=0;
 
@@ -841,10 +829,10 @@ xfs_qm_log_quotaoff(
        qoffi = xfs_trans_get_qoff_item(tp, NULL, flags & XFS_ALL_QUOTA_ACCT);
        xfs_trans_log_quotaoff_item(tp, qoffi);
 
-       s = XFS_SB_LOCK(mp);
+       spin_lock(&mp->m_sb_lock);
        oldsbqflag = mp->m_sb.sb_qflags;
        mp->m_sb.sb_qflags = (mp->m_qflags & ~(flags)) & XFS_MOUNT_QUOTA_ALL;
-       XFS_SB_UNLOCK(mp, s);
+       spin_unlock(&mp->m_sb_lock);
 
        xfs_mod_sb(tp, XFS_SB_QFLAGS);
 
@@ -854,7 +842,7 @@ xfs_qm_log_quotaoff(
         * We don't care about quotoff's performance.
         */
        xfs_trans_set_sync(tp);
-       error = xfs_trans_commit(tp, 0, NULL);
+       error = xfs_trans_commit(tp, 0);
 
 error0:
        if (error) {
@@ -863,9 +851,9 @@ error0:
                 * No one else is modifying sb_qflags, so this is OK.
                 * We still hold the quotaofflock.
                 */
-               s = XFS_SB_LOCK(mp);
+               spin_lock(&mp->m_sb_lock);
                mp->m_sb.sb_qflags = oldsbqflag;
-               XFS_SB_UNLOCK(mp, s);
+               spin_unlock(&mp->m_sb_lock);
        }
        *qoffstartp = qoffi;
        return (error);
@@ -913,14 +901,19 @@ xfs_qm_export_dquot(
         * gets turned off. No need to confuse the user level code,
         * so return zeroes in that case.
         */
-       if (! XFS_IS_QUOTA_ENFORCED(mp)) {
+       if ((!XFS_IS_UQUOTA_ENFORCED(mp) && src->d_flags == XFS_DQ_USER) ||
+           (!XFS_IS_OQUOTA_ENFORCED(mp) &&
+                       (src->d_flags & (XFS_DQ_PROJ | XFS_DQ_GROUP)))) {
                dst->d_btimer = 0;
                dst->d_itimer = 0;
                dst->d_rtbtimer = 0;
        }
 
 #ifdef DEBUG
-       if (XFS_IS_QUOTA_ENFORCED(mp) && dst->d_id != 0) {
+       if (((XFS_IS_UQUOTA_ENFORCED(mp) && dst->d_flags == XFS_USER_QUOTA) ||
+            (XFS_IS_OQUOTA_ENFORCED(mp) &&
+                       (dst->d_flags & (XFS_PROJ_QUOTA | XFS_GROUP_QUOTA)))) &&
+           dst->d_id != 0) {
                if (((int) dst->d_bcount >= (int) dst->d_blk_softlimit) &&
                    (dst->d_blk_softlimit > 0)) {
                        ASSERT(dst->d_btimer != 0);