yaffs: Remove a whole lot of function wrappers and forward declarations
[yaffs2.git] / yaffs_yaffs2.c
index 97dac454f34cf3b8ed4649eae8e8f56a1d2b3e52..87733fd49efd1d027222a879a73f8ead0afe8f75 100644 (file)
@@ -536,8 +536,9 @@ static int yaffs2_rd_checkpt_tnodes(struct yaffs_obj *obj)
                if (tn) {
                        ok = (yaffs2_checkpt_rd(dev, tn, dev->tnode_size) ==
                              dev->tnode_size);
-               } else
+               } else {
                        ok = 0;
+                }
 
                if (tn && ok)
                        ok = yaffs_add_find_tnode_0(dev,
@@ -632,9 +633,9 @@ static int yaffs2_rd_checkpt_objs(struct yaffs_dev *dev)
                    TENDSTR), cp.obj_id, cp.parent_id, cp.variant_type,
                   cp.hdr_chunk));
 
-               if (ok && cp.obj_id == ~0)
+               if (ok && cp.obj_id == ~0) {
                        done = 1;
-               else if (ok) {
+               else if (ok) {
                        obj =
                            yaffs_find_or_create_by_number(dev, cp.obj_id,
                                                           cp.variant_type);
@@ -650,8 +651,9 @@ static int yaffs2_rd_checkpt_objs(struct yaffs_dev *dev)
                                            (struct list_head *)hard_list;
                                        hard_list = obj;
                                }
-                       } else
+                       } else {
                                ok = 0;
+                        }
                }
        }
 
@@ -826,7 +828,7 @@ int yaffs_checkpoint_save(struct yaffs_dev *dev)
                yaffs2_wr_checkpt_data(dev);
        }
 
-       T(YAFFS_TRACE_ALWAYS,
+       T(YAFFS_TRACE_CHECKPOINT | YAFFS_TRACE_MOUNT,
          (TSTR("save exit: is_checkpointed %d" TENDSTR),
           dev->is_checkpointed));
 
@@ -918,8 +920,9 @@ int yaffs2_handle_hole(struct yaffs_obj *obj, loff_t new_size)
                        if (written == this_write) {
                                pos += this_write;
                                increase -= this_write;
-                       } else
+                       } else {
                                small_increase_ok = 0;
+                        }
                }
 
                yaffs_release_temp_buffer(dev, local_buffer, __LINE__);
@@ -998,11 +1001,12 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
 
        dev->seq_number = YAFFS_LOWEST_SEQUENCE_NUMBER;
 
-       block_index = YMALLOC(n_blocks * sizeof(struct yaffs_block_index));
+       block_index = kmalloc(n_blocks * sizeof(struct yaffs_block_index),
+                       GFP_NOFS);
 
        if (!block_index) {
                block_index =
-                   YMALLOC_ALT(n_blocks * sizeof(struct yaffs_block_index));
+                   vmalloc(n_blocks * sizeof(struct yaffs_block_index));
                alt_block_index = 1;
        }
 
@@ -1079,13 +1083,13 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
        T(YAFFS_TRACE_SCAN,
          (TSTR("%d blocks to be sorted..." TENDSTR), n_to_scan));
 
-       YYIELD();
+       cond_resched();
 
        /* Sort the blocks by sequence number */
-       yaffs_sort(block_index, n_to_scan, sizeof(struct yaffs_block_index),
-                  yaffs2_ybicmp);
+       sort(block_index, n_to_scan, sizeof(struct yaffs_block_index),
+                  yaffs2_ybicmp, NULL);
 
-       YYIELD();
+       cond_resched();
 
        T(YAFFS_TRACE_SCAN, (TSTR("...done" TENDSTR)));
 
@@ -1100,7 +1104,7 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
             block_iter--) {
                /* Cooperative multitasking! This loop can run for so
                   long that watchdog timers expire. */
-               YYIELD();
+               cond_resched();
 
                /* get the block to scan in the correct order */
                blk = block_index[block_iter].block;
@@ -1410,9 +1414,9 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
                                                in->yst_mode = oh->yst_mode;
                                                yaffs_load_attribs(in, oh);
                                                in->lazy_loaded = 0;
-                                       } else
+                                       } else {
                                                in->lazy_loaded = 1;
-
+                                        }
                                        in->hdr_chunk = chunk;
 
                                } else if (!in->valid) {
@@ -1476,8 +1480,7 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
                                                               variant.dir_variant.children);
                                        } else if (!parent
                                                   || parent->variant_type !=
-                                                  YAFFS_OBJECT_TYPE_DIRECTORY)
-                                       {
+                                                  YAFFS_OBJECT_TYPE_DIRECTORY) {
                                                /* Hoosterman, another problem....
                                                 * We're trying to use a non-directory as a directory
                                                 */
@@ -1596,9 +1599,9 @@ int yaffs2_scan_backwards(struct yaffs_dev *dev)
        yaffs_skip_rest_of_block(dev);
 
        if (alt_block_index)
-               YFREE_ALT(block_index);
+               vfree(block_index);
        else
-               YFREE(block_index);
+               kfree(block_index);
 
        /* Ok, we've done all the scanning.
         * Fix up the hard link chains.