裸机移植yaffs2文件系统(六)

2014-11-24 03:17:17 · 作者: · 浏览: 25
d_only;

int is_checkpointed;


/* Stuff to support block offsetting to support start block zero */

int internal_start_block;

int internal_end_block;

int block_offset;

int chunk_offset;


/* Runtime checkpointing stuff */

int checkpt_page_seq; /* running sequence number of checkpt pages */

int checkpt_byte_count;

int checkpt_byte_offs;

u8 *checkpt_buffer;

int checkpt_open_write;

int blocks_in_checkpt;

int checkpt_cur_chunk;

int checkpt_cur_block;

int checkpt_next_block;

int *checkpt_block_list;

int checkpt_max_blocks;

u32 checkpt_sum;

u32 checkpt_xor;


int checkpoint_blocks_required; /* Number of blocks needed to store

* current checkpoint set */


/* Block Info */

struct yaffs_block_info *block_info;

u8 *chunk_bits; /* bitmap of chunks in use */

unsigned block_info_alt:1; /* allocated using alternative alloc */

unsigned chunk_bits_alt:1; /* allocated using alternative alloc */

int chunk_bit_stride; /* Number of bytes of chunk_bits per block.

* Must be consistent with chunks_per_block.

*/


int n_erased_blocks;

int alloc_block; /* Current block being allocated off */

u32 alloc_page;

int alloc_block_finder; /* Used to search for next allocation block */


/* Object and Tnode memory management */

void *allocator;

int n_obj;

int n_tnodes;


int n_hardlinks;


struct yaffs_obj_bucket obj_bucket[YAFFS_NOBJECT_BUCKETS];

u32 bucket_finder;


int n_free_chunks;


/* Garbage collection control */

u32 *gc_cleanup_list; /* objects to delete at the end of a GC. */

u32 n_clean_ups;


unsigned has_pending_prioritised_gc; /* We think this device might

have pending prioritised gcs */

unsigned gc_disable;

unsigned gc_block_finder;

unsigned gc_dirtiest;

unsigned gc_pages_in_use;

unsigned gc_not_done;

unsigned gc_block;

unsigned gc_chunk;

unsigned gc_skip;

struct yaffs_summary_tags *gc_sum_tags;


/* Special directories */

struct yaffs_obj *root_dir;

struct yaffs_obj *lost_n_found;


int buffered_block; /* Which block is buffered here */

int doing_buffered_block_rewrite;


struct yaffs_cache *cache;

int cache_last_use;


/* Stuff for background deletion and unlinked files. */

struct yaffs_obj *unlinked_dir; /* Directory where unlinked and deleted

files live. */

struct yaffs_obj *del_dir; /* Directory where deleted objects are

sent to disappear. */

struct yaffs_obj *unlinked_deletion; /* Current file being

background deleted. */

int n_deleted_files; /* Count of files awaiting deletion; */

int n_unlinked_files; /* Count of unlinked files. */

int n_bg_deletions; /* Count of background deletions. */


/* Temporary buffer management */

struct yaffs_buffer temp_buffer[YAFFS_N_TEMP_BUFFERS];

int max_temp;

int temp_in_use;

int unmanaged_buffer_allocs;

int unmanaged_buffer_deallocs;


/* yaffs2 runtime stuff */

unsigned seq_number; /* Sequence number of currently

allocating block */

unsigned oldest_dirty_seq;

unsigned oldest_dirty_block;


/* Block refreshing */

int refresh_skip; /* A skip down counter.

* Refresh happens when this gets to zero. */


/* Dirty directory handling */

struct list_head dirty_dirs; /* List of dirty directorie