struct yaffs_block_info *bi;
u32 threshold = dev->param.chunks_per_block;
+ (void) prioritised;
+
/* First let's see if we need to grab a prioritised block */
if (dev->has_pending_prioritised_gc && !aggressive) {
dev->gc_dirtiest = 0;
{
int erased_chunks = dev->n_erased_blocks * dev->param.chunks_per_block;
+ (void) urgency;
yaffs_trace(YAFFS_TRACE_BACKGROUND, "Background gc %u", urgency);
yaffs_check_gc(dev, 1);
struct yaffs_ext_tags tags;
struct yaffs_block_info *bi;
+ (void) lyn;
if (chunk_id <= 0)
return;
result = yaffs_rd_chunk_tags_nand(dev, in->hdr_chunk, buf, &tags);
- if (result == YAFFS_FAIL)
+ if (result == YAFFS_FAIL) {
+ yaffs_release_temp_buffer(dev, buf);
return;
+ }
oh = (struct yaffs_obj_hdr *)buf;
bi->has_shrink_hdr = 1;
}
-
return new_chunk_id;
}
return YAFFS_FAIL;
}
+ if (!yaffs_init_tmp_buffers(dev))
+ return YAFFS_FAIL;
+
if (yaffs_init_nand(dev) != YAFFS_OK) {
yaffs_trace(YAFFS_TRACE_ALWAYS, "InitialiseNAND failed");
return YAFFS_FAIL;
}
+ dev->ll_init = 1;
+
return YAFFS_OK;
}
yaffs_endian_config(dev);
- /* Initialise temporary buffers and caches. */
- if (!yaffs_init_tmp_buffers(dev))
- init_failed = 1;
-
+ /* Initialise temporary caches. */
dev->gc_cleanup_list = NULL;
-
- dev->cache = NULL;
-
if (!init_failed)
init_failed = yaffs_cache_init(dev) < 0;
int n_free;
int n_dirty_caches;
int blocks_for_checkpt;
- u32 i;
n_free = dev->n_free_chunks;
n_free += dev->n_deleted_files;
/* Now count and subtract the number of dirty chunks in the cache. */
-
- for (n_dirty_caches = 0, i = 0; i < dev->param.n_caches; i++) {
- if (dev->cache[i].dirty)
- n_dirty_caches++;
- }
-
+ n_dirty_caches = yaffs_count_dirty_caches(dev);
n_free -= n_dirty_caches;
n_free -=