]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/xfs/quota/xfs_qm.c
introduce I_SYNC
[linux-2.6-omap-h63xx.git] / fs / xfs / quota / xfs_qm.c
index 1de2acdc7f70eab902b24c403b54962bb6b95d74..6ff0f4de1630cb40665950393fb264e483636cc5 100644 (file)
@@ -62,10 +62,8 @@ uint         ndquot;
 
 kmem_zone_t    *qm_dqzone;
 kmem_zone_t    *qm_dqtrxzone;
-static kmem_shaker_t   xfs_qm_shaker;
 
 static cred_t  xfs_zerocr;
-static xfs_inode_t     xfs_zeroino;
 
 STATIC void    xfs_qm_list_init(xfs_dqlist_t *, char *, int);
 STATIC void    xfs_qm_list_destroy(xfs_dqlist_t *);
@@ -79,6 +77,11 @@ STATIC int   xfs_qm_init_quotainos(xfs_mount_t *);
 STATIC int     xfs_qm_init_quotainfo(xfs_mount_t *);
 STATIC int     xfs_qm_shake(int, gfp_t);
 
+static struct shrinker xfs_qm_shaker = {
+       .shrink = xfs_qm_shake,
+       .seeks = DEFAULT_SEEKS,
+};
+
 #ifdef DEBUG
 extern mutex_t qcheck_lock;
 #endif
@@ -117,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);
@@ -150,7 +154,7 @@ xfs_Gqm_init(void)
        } else
                xqm->qm_dqzone = qm_dqzone;
 
-       xfs_qm_shaker = kmem_shake_register(xfs_qm_shake);
+       register_shrinker(&xfs_qm_shaker);
 
        /*
         * The t_dqinfo portion of transactions.
@@ -182,7 +186,7 @@ xfs_qm_destroy(
 
        ASSERT(xqm != NULL);
        ASSERT(xqm->qm_nrefs == 0);
-       kmem_shake_deregister(xfs_qm_shaker);
+       unregister_shrinker(&xfs_qm_shaker);
        hsize = xqm->qm_dqhashmask + 1;
        for (i = 0; i < hsize; i++) {
                xfs_qm_list_destroy(&(xqm->qm_usr_dqhtable[i]));
@@ -388,6 +392,17 @@ xfs_qm_mount_quotas(
                        return XFS_ERROR(error);
                }
        }
+       /* 
+        * If one type of quotas is off, then it will lose its
+        * quotachecked status, since we won't be doing accounting for
+        * that type anymore.
+        */
+       if (!XFS_IS_UQUOTA_ON(mp)) {
+               mp->m_qflags &= ~XFS_UQUOTA_CHKD;
+       }
+       if (!(XFS_IS_GQUOTA_ON(mp) || XFS_IS_PQUOTA_ON(mp))) {
+               mp->m_qflags &= ~XFS_OQUOTA_CHKD;
+       }
 
  write_changes:
        /*
@@ -1404,7 +1419,7 @@ xfs_qm_qino_alloc(
                return error;
        }
 
-       if ((error = xfs_dir_ialloc(&tp, &xfs_zeroino, S_IFREG, 1, 0,
+       if ((error = xfs_dir_ialloc(&tp, NULL, S_IFREG, 1, 0,
                                   &xfs_zerocr, 0, 1, ip, &committed))) {
                xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES |
                                 XFS_TRANS_ABORT);
@@ -1453,8 +1468,7 @@ xfs_qm_qino_alloc(
        XFS_SB_UNLOCK(mp, s);
        xfs_mod_sb(tp, sbfields);
 
-       if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES,
-                                    NULL))) {
+       if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) {
                xfs_fs_cmn_err(CE_ALERT, mp, "XFS qino_alloc failed!");
                return error;
        }
@@ -2405,7 +2419,7 @@ xfs_qm_write_sb_changes(
        }
 
        xfs_mod_sb(tp, flags);
-       (void) xfs_trans_commit(tp, 0, NULL);
+       (void) xfs_trans_commit(tp, 0);
 
        return 0;
 }