]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/vfs/vfs_quota.c
xnu-7195.50.7.100.1.tar.gz
[apple/xnu.git] / bsd / vfs / vfs_quota.c
index 63c4afcb5c6d9746ecee0a91b051a3b9ac3d0e6f..b58c75e27d7c37db1f7660011013cea73ed08ab2 100644 (file)
@@ -67,7 +67,7 @@
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/systm.h>
-#include <sys/malloc.h>
+#include <kern/zalloc.h>
 #include <sys/file_internal.h>
 #include <sys/proc_internal.h>
 #include <sys/vnode_internal.h>
@@ -119,6 +119,8 @@ TAILQ_HEAD(dqfreelist, dquot) dqfreelist;
  */
 TAILQ_HEAD(dqdirtylist, dquot) dqdirtylist;
 
+ZONE_VIEW_DEFINE(ZV_DQUOT, "FS quota entries", KHEAP_ID_DEFAULT,
+    sizeof(struct dquot));
 
 static int  dqlookup(struct quotafile *, u_int32_t, struct      dqblk *, u_int32_t *);
 static int  dqsync_locked(struct dquot *dq);
@@ -595,7 +597,7 @@ relookup:
                         * but we found the dq we were looking for in
                         * the cache the 2nd time through so free it
                         */
-                       _FREE(ndq, M_DQUOT);
+                       zfree(ZV_DQUOT, ndq);
                }
                *dqp = dq;
 
@@ -620,12 +622,12 @@ relookup:
        } else if (numdquot < desireddquot) {
                if (ndq == NULL) {
                        /*
-                        * drop the quota list lock since MALLOC may block
+                        * drop the quota list lock since zalloc may block
                         */
                        dq_list_unlock();
 
-                       ndq = (struct dquot *)_MALLOC(sizeof *dq, M_DQUOT, M_WAITOK);
-                       bzero((char *)ndq, sizeof *dq);
+                       ndq = (struct dquot *)zalloc_flags(ZV_DQUOT,
+                           Z_WAITOK | Z_ZERO);
 
                        listlockval = dq_list_lock();
                        /*
@@ -655,7 +657,7 @@ relookup:
                                 * but we're now at the limit of our cache size
                                 * so free it
                                 */
-                               _FREE(ndq, M_DQUOT);
+                               zfree(ZV_DQUOT, ndq);
                        }
                        tablefull("dquot");
                        *dqp = NODQUOT;
@@ -738,7 +740,7 @@ relookup:
                 * but we didn't need it, so free it after
                 * we've droped the quota list lock
                 */
-               _FREE(ndq, M_DQUOT);
+               zfree(ZV_DQUOT, ndq);
        }
 
        error = dqlookup(qfp, id, &dq->dq_dqb, &dq->dq_index);