- int i;
- int inode_chunk;
- int the_chunk;
- yaffs_ext_tags tags;
- int found_chunk;
- yaffs_dev_t *dev = in->my_dev;
-
- int all_done = 1;
-
- if (tn) {
- if (level > 0) {
- for (i = YAFFS_NTNODES_INTERNAL - 1; all_done && i >= 0;
- i--) {
- if (tn->internal[i]) {
- if (limit && (*limit) < 0) {
- all_done = 0;
- } else {
- all_done =
- yaffs_del_worker(in,
- tn->
- internal
- [i],
- level -
- 1,
- (chunk_offset
- <<
- YAFFS_TNODES_INTERNAL_BITS)
- + i,
- limit);
- }
- if (all_done) {
- yaffs_free_tnode(dev,
- tn->
- internal[i]);
- tn->internal[i] = NULL;
- }
- }
- }
- return (all_done) ? 1 : 0;
- } else if (level == 0) {
- int hit_limit = 0;
-
- for (i = YAFFS_NTNODES_LEVEL0 - 1; i >= 0 && !hit_limit;
- i--) {
- the_chunk = yaffs_get_group_base(dev, tn, i);
- if (the_chunk) {
-
- inode_chunk = (chunk_offset <<
- YAFFS_TNODES_LEVEL0_BITS) + i;
-
- found_chunk =
- yaffs_find_chunk_in_group(dev,
- the_chunk,
- &tags,
- in->obj_id,
- inode_chunk);
-
- if (found_chunk > 0) {
- yaffs_chunk_del(dev,
- found_chunk, 1,
- __LINE__);
- in->n_data_chunks--;
- if (limit) {
- *limit = *limit - 1;
- if (*limit <= 0)
- hit_limit = 1;
- }
-
- }
-
- yaffs_load_tnode_0(dev, tn, i, 0);
- }
-
- }
- return (i < 0) ? 1 : 0;
-
- }
-
- }
-
- return 1;
-
-}
-
-#endif
-
-static void yaffs_soft_del_chunk(yaffs_dev_t *dev, int chunk)
-{
- yaffs_block_info_t *the_block;