yaffs: Replace YBUG() with BUG()
[yaffs2.git] / yaffs_allocator.c
index 59cce04a0ea8b2b57ce98047aab864f03b5ed33e..1dd0c27b91682b8cd274d8d4a67d9ddf019566d2 100644 (file)
 #include "yaffs_trace.h"
 #include "yportenv.h"
 
-#ifdef CONFIG_YAFFS_KMALLOC_ALLOCATOR
-/* This is an alternative debug allocator. Don't use for production code. */
-
-void yaffs_deinit_raw_tnodes_and_objs(struct yaffs_dev *dev)
-{
-       dev = dev;
-}
-
-void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
-{
-       dev = dev;
-}
-
-struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev)
-{
-       return kmalloc(dev->tnode_size, GFP_NOFS);
-}
-
-void yaffs_free_raw_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn)
-{
-       dev = dev;
-       kfree(tn);
-}
-
-void yaffs_init_raw_objs(struct yaffs_dev *dev)
-{
-       dev = dev;
-}
-
-void yaffs_deinit_raw_objs(struct yaffs_dev *dev)
-{
-       dev = dev;
-}
-
-struct yaffs_obj *yaffs_alloc_raw_obj(struct yaffs_dev *dev)
-{
-       dev = dev;
-       return kmalloc(sizeof(struct yaffs_obj));
-}
-
-void yaffs_free_raw_obj(struct yaffs_dev *dev, struct yaffs_obj *obj)
-{
-
-       dev = dev;
-       kfree(obj);
-}
-
-#else
 
 struct yaffs_tnode_list {
        struct yaffs_tnode_list *next;
@@ -95,7 +47,7 @@ static void yaffs_deinit_raw_tnodes(struct yaffs_dev *dev)
        struct yaffs_tnode_list *tmp;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return;
        }
 
@@ -122,7 +74,7 @@ static void yaffs_init_raw_tnodes(struct yaffs_dev *dev)
                allocator->n_free_tnodes = 0;
                allocator->n_tnodes_created = 0;
        } else {
-               YBUG();
+               BUG();
        }
 }
 
@@ -138,7 +90,7 @@ static int yaffs_create_tnodes(struct yaffs_dev *dev, int n_tnodes)
        struct yaffs_tnode_list *tnl;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return YAFFS_FAIL;
        }
 
@@ -196,7 +148,7 @@ struct yaffs_tnode *yaffs_alloc_raw_tnode(struct yaffs_dev *dev)
        struct yaffs_tnode *tn = NULL;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return NULL;
        }
 
@@ -219,7 +171,7 @@ void yaffs_free_raw_tnode(struct yaffs_dev *dev, struct yaffs_tnode *tn)
        struct yaffs_allocator *allocator = dev->allocator;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return;
        }
 
@@ -240,7 +192,7 @@ static void yaffs_init_raw_objs(struct yaffs_dev *dev)
                allocator->free_objs = NULL;
                allocator->n_free_objects = 0;
        } else {
-               YBUG();
+               BUG();
        }
 }
 
@@ -250,7 +202,7 @@ static void yaffs_deinit_raw_objs(struct yaffs_dev *dev)
        struct yaffs_obj_list *tmp;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return;
        }
 
@@ -275,7 +227,7 @@ static int yaffs_create_free_objs(struct yaffs_dev *dev, int n_obj)
        struct yaffs_obj_list *list;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return YAFFS_FAIL;
        }
 
@@ -322,7 +274,7 @@ struct yaffs_obj *yaffs_alloc_raw_obj(struct yaffs_dev *dev)
        struct yaffs_allocator *allocator = dev->allocator;
 
        if (!allocator) {
-               YBUG();
+               BUG();
                return obj;
        }
 
@@ -346,7 +298,7 @@ void yaffs_free_raw_obj(struct yaffs_dev *dev, struct yaffs_obj *obj)
        struct yaffs_allocator *allocator = dev->allocator;
 
        if (!allocator)
-               YBUG();
+               BUG();
        else {
                /* Link into the free list. */
                obj->siblings.next = (struct list_head *)(allocator->free_objs);
@@ -364,7 +316,7 @@ void yaffs_deinit_raw_tnodes_and_objs(struct yaffs_dev *dev)
                kfree(dev->allocator);
                dev->allocator = NULL;
        } else {
-               YBUG();
+               BUG();
        }
 }
 
@@ -380,8 +332,7 @@ void yaffs_init_raw_tnodes_and_objs(struct yaffs_dev *dev)
                        yaffs_init_raw_objs(dev);
                }
        } else {
-               YBUG();
+               BUG();
        }
 }
 
-#endif