mm: memcontrol: move kmem accounting code to CONFIG_MEMCG
[cascardo/linux.git] / fs / dcache.c
index d27f090..b4539e8 100644 (file)
@@ -1571,7 +1571,8 @@ struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name)
        dentry->d_iname[DNAME_INLINE_LEN-1] = 0;
        if (name->len > DNAME_INLINE_LEN-1) {
                size_t size = offsetof(struct external_name, name[1]);
-               struct external_name *p = kmalloc(size + name->len, GFP_KERNEL);
+               struct external_name *p = kmalloc(size + name->len,
+                                                 GFP_KERNEL_ACCOUNT);
                if (!p) {
                        kmem_cache_free(dentry_cache, dentry); 
                        return NULL;
@@ -3303,18 +3304,18 @@ out:
  * @new_dentry: new dentry
  * @old_dentry: old dentry
  *
- * Returns 1 if new_dentry is a subdirectory of the parent (at any depth).
- * Returns 0 otherwise.
+ * Returns true if new_dentry is a subdirectory of the parent (at any depth).
+ * Returns false otherwise.
  * Caller must ensure that "new_dentry" is pinned before calling is_subdir()
  */
   
-int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
+bool is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
 {
-       int result;
+       bool result;
        unsigned seq;
 
        if (new_dentry == old_dentry)
-               return 1;
+               return true;
 
        do {
                /* for restarting inner loop in case of seq retry */
@@ -3325,9 +3326,9 @@ int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
                 */
                rcu_read_lock();
                if (d_ancestor(old_dentry, new_dentry))
-                       result = 1;
+                       result = true;
                else
-                       result = 0;
+                       result = false;
                rcu_read_unlock();
        } while (read_seqretry(&rename_lock, seq));
 
@@ -3415,7 +3416,7 @@ static void __init dcache_init(void)
         * of the dcache. 
         */
        dentry_cache = KMEM_CACHE(dentry,
-               SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD);
+               SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD|SLAB_ACCOUNT);
 
        /* Hash may have been set up in dcache_init_early */
        if (!hashdist)