1 /* $Id: jffs2_fs_sb.h,v 1.37 2003/01/17 16:04:44 dwmw2 Exp $ */
6 #include <linux/types.h>
7 #include <linux/spinlock.h>
8 #include <linux/workqueue.h>
9 #include <linux/completion.h>
10 #include <asm/semaphore.h>
11 #include <linux/timer.h>
12 #include <linux/wait.h>
13 #include <linux/list.h>
15 #define JFFS2_SB_FLAG_RO 1
16 #define JFFS2_SB_FLAG_MOUNTING 2
18 /* A struct for the overall file system control. Pointers to
19 jffs2_sb_info structs are named `c' in the source code.
22 struct jffs2_sb_info
{
30 struct task_struct
*gc_task
; /* GC task struct */
31 struct semaphore gc_thread_start
; /* GC thread start mutex */
32 struct completion gc_thread_exit
; /* GC thread exit completion port */
34 struct semaphore alloc_sem
; /* Used to protect all the following
35 fields, and also to protect against
36 out-of-order writing of nodes.
39 uint32_t cleanmarker_size
; /* Size of an _inline_ CLEANMARKER
40 (i.e. zero for OOB CLEANMARKER */
47 uint32_t erasing_size
;
50 uint32_t unchecked_size
;
52 uint32_t nr_free_blocks
;
53 uint32_t nr_erasing_blocks
;
56 struct jffs2_eraseblock
*blocks
; /* The whole array of blocks. Used for getting blocks
57 * from the offset (blocks[ofs / sector_size]) */
58 struct jffs2_eraseblock
*nextblock
; /* The block we're currently filling */
60 struct jffs2_eraseblock
*gcblock
; /* The block we're currently garbage-collecting */
62 struct list_head clean_list
; /* Blocks 100% full of clean data */
63 struct list_head very_dirty_list
; /* Blocks with lots of dirty space */
64 struct list_head dirty_list
; /* Blocks with some dirty space */
65 struct list_head erasable_list
; /* Blocks which are completely dirty, and need erasing */
66 struct list_head erasable_pending_wbuf_list
; /* Blocks which need erasing but only after the current wbuf is flushed */
67 struct list_head erasing_list
; /* Blocks which are currently erasing */
68 struct list_head erase_pending_list
; /* Blocks which need erasing now */
69 struct list_head erase_complete_list
; /* Blocks which are erased and need the clean marker written to them */
70 struct list_head free_list
; /* Blocks which are free and ready to be used */
71 struct list_head bad_list
; /* Bad blocks. */
72 struct list_head bad_used_list
; /* Bad blocks with valid data in. */
74 spinlock_t erase_completion_lock
; /* Protect free_list and erasing_list
75 against erase completion handler */
76 wait_queue_head_t erase_wait
; /* For waiting for erases to complete */
78 wait_queue_head_t inocache_wq
;
79 struct jffs2_inode_cache
**inocache_list
;
80 spinlock_t inocache_lock
;
82 /* Sem to allow jffs2_garbage_collect_deletion_dirent to
83 drop the erase_completion_lock while it's holding a pointer
84 to an obsoleted node. I don't like this. Alternatives welcomed. */
85 struct semaphore erase_free_sem
;
87 /* Write-behind buffer for NAND flash */
91 uint32_t wbuf_pagesize
;
92 struct work_struct wbuf_task
; /* task for timed wbuf flush */
93 struct timer_list wbuf_timer
; /* timer for flushing wbuf */
95 /* OS-private pointer for getting back to master superblock info */
99 #endif /* _JFFS2_FB_SB */