yaffs Added more tests to direct/timothy_tests/mirror_tests
[yaffs2.git] / yaffs_yaffs1.c
index 4ab0f22bb563959febbd22f0715237482f14ff60..9eb6030825475133b8c02508aec0f11aa39db6d1 100644 (file)
@@ -42,9 +42,9 @@ int yaffs1_scan(struct yaffs_dev *dev)
 
        u8 *chunk_data;
 
-       T(YAFFS_TRACE_SCAN,
-         (TSTR("yaffs1_scan starts  intstartblk %d intendblk %d..." TENDSTR),
-          dev->internal_start_block, dev->internal_end_block));
+       yaffs_trace(YAFFS_TRACE_SCAN,
+               "yaffs1_scan starts  intstartblk %d intendblk %d...",
+               dev->internal_start_block, dev->internal_end_block);
 
        chunk_data = yaffs_get_temp_buffer(dev, __LINE__);
 
@@ -66,16 +66,15 @@ int yaffs1_scan(struct yaffs_dev *dev)
                if (bi->seq_number == YAFFS_SEQUENCE_BAD_BLOCK)
                        bi->block_state = state = YAFFS_BLOCK_STATE_DEAD;
 
-               T(YAFFS_TRACE_SCAN_DEBUG,
-                 (TSTR("Block scanning block %d state %d seq %d" TENDSTR), blk,
-                  state, seq_number));
+               yaffs_trace(YAFFS_TRACE_SCAN_DEBUG,
+                       "Block scanning block %d state %d seq %d",
+                       blk, state, seq_number);
 
                if (state == YAFFS_BLOCK_STATE_DEAD) {
-                       T(YAFFS_TRACE_BAD_BLOCKS,
-                         (TSTR("block %d is bad" TENDSTR), blk));
+                       yaffs_trace(YAFFS_TRACE_BAD_BLOCKS,
+                               "block %d is bad", blk);
                } else if (state == YAFFS_BLOCK_STATE_EMPTY) {
-                       T(YAFFS_TRACE_SCAN_DEBUG,
-                         (TSTR("Block empty " TENDSTR)));
+                       yaffs_trace(YAFFS_TRACE_SCAN_DEBUG, "Block empty ");
                        dev->n_erased_blocks++;
                        dev->n_free_chunks += dev->param.chunks_per_block;
                }
@@ -86,7 +85,7 @@ int yaffs1_scan(struct yaffs_dev *dev)
        for (blk = dev->internal_start_block;
             !alloc_failed && blk <= dev->internal_end_block; blk++) {
 
-               YYIELD();
+               cond_resched();
 
                bi = yaffs_get_block_info(dev, blk);
                state = bi->block_state;
@@ -124,10 +123,9 @@ int yaffs1_scan(struct yaffs_dev *dev)
                                        dev->n_erased_blocks++;
                                } else {
                                        /* this is the block being allocated from */
-                                       T(YAFFS_TRACE_SCAN,
-                                         (TSTR
-                                          (" Allocating from %d %d" TENDSTR),
-                                          blk, c));
+                                       yaffs_trace(YAFFS_TRACE_SCAN,
+                                               " Allocating from %d %d",
+                                               blk, c);
                                        state = YAFFS_BLOCK_STATE_ALLOCATING;
                                        dev->alloc_block = blk;
                                        dev->alloc_page = c;
@@ -217,20 +215,19 @@ int yaffs1_scan(struct yaffs_dev *dev)
 
                                        struct yaffs_shadow_fixer *fixer;
                                        fixer =
-                                           YMALLOC(sizeof
-                                                   (struct
-                                                    yaffs_shadow_fixer));
+                                               kmalloc(sizeof
+                                               (struct yaffs_shadow_fixer),
+                                               GFP_NOFS);
                                        if (fixer) {
                                                fixer->next = shadow_fixers;
                                                shadow_fixers = fixer;
                                                fixer->obj_id = tags.obj_id;
                                                fixer->shadowed_id =
                                                    oh->shadows_obj;
-                                               T(YAFFS_TRACE_SCAN,
-                                                 (TSTR
-                                                  (" Shadow fixer: %d shadows %d"
-                                                   TENDSTR), fixer->obj_id,
-                                                  fixer->shadowed_id));
+                                               yaffs_trace(YAFFS_TRACE_SCAN,
+                                                       " Shadow fixer: %d shadows %d",
+                                                       fixer->obj_id,
+                                                       fixer->shadowed_id);
 
                                        }
 
@@ -303,16 +300,14 @@ int yaffs1_scan(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
                                                 */
 
-                                               T(YAFFS_TRACE_ERROR,
-                                                 (TSTR
-                                                  ("yaffs tragedy: attempting to use non-directory as a directory in scan. Put in lost+found."
-                                                   TENDSTR)));
+                                               yaffs_trace(YAFFS_TRACE_ERROR,
+                                                       "yaffs tragedy: attempting to use non-directory as a directory in scan. Put in lost+found."
+                                                       );
                                                parent = dev->lost_n_found;
                                        }
 
@@ -423,7 +418,7 @@ int yaffs1_scan(struct yaffs_dev *dev)
                        if (obj)
                                yaffs_update_oh(obj, NULL, 1, 0, 0, NULL);
 
-                       YFREE(fixer);
+                       kfree(fixer);
                }
        }
 
@@ -432,7 +427,7 @@ int yaffs1_scan(struct yaffs_dev *dev)
        if (alloc_failed)
                return YAFFS_FAIL;
 
-       T(YAFFS_TRACE_SCAN, (TSTR("yaffs1_scan ends" TENDSTR)));
+       yaffs_trace(YAFFS_TRACE_SCAN, "yaffs1_scan ends");
 
        return YAFFS_OK;
 }