]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/xfs/quota/xfs_qm.c
Merge branches 'release' and 'autoload' into release
[linux-2.6-omap-h63xx.git] / fs / xfs / quota / xfs_qm.c
index 2d274b23ade51aeebf552cc0f17c81f38b9700ba..d488645f833d709f59fdb940bb6112e72d664655 100644 (file)
@@ -120,7 +120,8 @@ xfs_Gqm_init(void)
         * Initialize the dquot hash tables.
         */
        udqhash = kmem_zalloc_greedy(&hsize,
-                                    XFS_QM_HASHSIZE_LOW, XFS_QM_HASHSIZE_HIGH,
+                                    XFS_QM_HASHSIZE_LOW * sizeof(xfs_dqhash_t),
+                                    XFS_QM_HASHSIZE_HIGH * sizeof(xfs_dqhash_t),
                                     KM_SLEEP | KM_MAYFAIL | KM_LARGE);
        gdqhash = kmem_zalloc(hsize, KM_SLEEP | KM_LARGE);
        hsize /= sizeof(xfs_dqhash_t);
@@ -286,45 +287,6 @@ xfs_qm_rele_quotafs_ref(
        XFS_QM_UNLOCK(xfs_Gqm);
 }
 
-/*
- * This is called at mount time from xfs_mountfs to initialize the quotainfo
- * structure and start the global quota manager (xfs_Gqm) if it hasn't done
- * so already. Note that the superblock has not been read in yet.
- */
-void
-xfs_qm_mount_quotainit(
-       xfs_mount_t     *mp,
-       uint            flags)
-{
-       /*
-        * User, projects or group quotas has to be on.
-        */
-       ASSERT(flags & (XFSMNT_UQUOTA | XFSMNT_PQUOTA | XFSMNT_GQUOTA));
-
-       /*
-        * Initialize the flags in the mount structure. From this point
-        * onwards we look at m_qflags to figure out if quotas's ON/OFF, etc.
-        * Note that we enforce nothing if accounting is off.
-        * ie.  XFSMNT_*QUOTA must be ON for XFSMNT_*QUOTAENF.
-        * It isn't necessary to take the quotaoff lock to do this; this is
-        * called from mount.
-        */
-       if (flags & XFSMNT_UQUOTA) {
-               mp->m_qflags |= (XFS_UQUOTA_ACCT | XFS_UQUOTA_ACTIVE);
-               if (flags & XFSMNT_UQUOTAENF)
-                       mp->m_qflags |= XFS_UQUOTA_ENFD;
-       }
-       if (flags & XFSMNT_GQUOTA) {
-               mp->m_qflags |= (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE);
-               if (flags & XFSMNT_GQUOTAENF)
-                       mp->m_qflags |= XFS_OQUOTA_ENFD;
-       } else if (flags & XFSMNT_PQUOTA) {
-               mp->m_qflags |= (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE);
-               if (flags & XFSMNT_PQUOTAENF)
-                       mp->m_qflags |= XFS_OQUOTA_ENFD;
-       }
-}
-
 /*
  * Just destroy the quotainfo structure.
  */
@@ -1038,7 +1000,7 @@ xfs_qm_dqdetach(
 int
 xfs_qm_sync(
        xfs_mount_t     *mp,
-       short           flags)
+       int             flags)
 {
        int             recl, restarts;
        xfs_dquot_t     *dqp;
@@ -1046,6 +1008,9 @@ xfs_qm_sync(
        boolean_t       nowait;
        int             error;
 
+       if (! XFS_IS_QUOTA_ON(mp))
+               return 0;
+
        restarts = 0;
        /*
         * We won't block unless we are asked to.
@@ -1716,7 +1681,6 @@ xfs_qm_get_rtblks(
        xfs_extnum_t    idx;                    /* extent record index */
        xfs_ifork_t     *ifp;                   /* inode fork pointer */
        xfs_extnum_t    nextents;               /* number of extent entries */
-       xfs_bmbt_rec_t  *ep;                    /* pointer to an extent entry */
        int             error;
 
        ASSERT(XFS_IS_REALTIME_INODE(ip));
@@ -1727,10 +1691,8 @@ xfs_qm_get_rtblks(
        }
        rtblks = 0;
        nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
-       for (idx = 0; idx < nextents; idx++) {
-               ep = xfs_iext_get_ext(ifp, idx);
-               rtblks += xfs_bmbt_get_blockcount(ep);
-       }
+       for (idx = 0; idx < nextents; idx++)
+               rtblks += xfs_bmbt_get_blockcount(xfs_iext_get_ext(ifp, idx));
        *O_rtblks = (xfs_qcnt_t)rtblks;
        return 0;
 }
@@ -2458,8 +2420,7 @@ xfs_qm_vop_dqalloc(
        lockflags = XFS_ILOCK_EXCL;
        xfs_ilock(ip, lockflags);
 
-       if ((flags & XFS_QMOPT_INHERIT) &&
-           XFS_INHERIT_GID(ip, XFS_MTOVFS(mp)))
+       if ((flags & XFS_QMOPT_INHERIT) && XFS_INHERIT_GID(ip))
                gid = ip->i_d.di_gid;
 
        /*