1 |
27 |
unneback |
/* $Id: jffs2_fs_sb.h,v 1.1.1.1 2004-02-14 13:29:21 phoenix Exp $ */
|
2 |
|
|
|
3 |
|
|
#ifndef _JFFS2_FS_SB
|
4 |
|
|
#define _JFFS2_FS_SB
|
5 |
|
|
|
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>
|
14 |
|
|
|
15 |
|
|
#define JFFS2_SB_FLAG_RO 1
|
16 |
|
|
#define JFFS2_SB_FLAG_MOUNTING 2
|
17 |
|
|
|
18 |
|
|
/* A struct for the overall file system control. Pointers to
|
19 |
|
|
jffs2_sb_info structs are named `c' in the source code.
|
20 |
|
|
Nee jffs_control
|
21 |
|
|
*/
|
22 |
|
|
struct jffs2_sb_info {
|
23 |
|
|
struct mtd_info *mtd;
|
24 |
|
|
|
25 |
|
|
uint32_t highest_ino;
|
26 |
|
|
uint32_t checked_ino;
|
27 |
|
|
|
28 |
|
|
unsigned int flags;
|
29 |
|
|
|
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 */
|
33 |
|
|
|
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.
|
37 |
|
|
And GC.
|
38 |
|
|
*/
|
39 |
|
|
uint32_t cleanmarker_size; /* Size of an _inline_ CLEANMARKER
|
40 |
|
|
(i.e. zero for OOB CLEANMARKER */
|
41 |
|
|
|
42 |
|
|
uint32_t flash_size;
|
43 |
|
|
uint32_t used_size;
|
44 |
|
|
uint32_t dirty_size;
|
45 |
|
|
uint32_t wasted_size;
|
46 |
|
|
uint32_t free_size;
|
47 |
|
|
uint32_t erasing_size;
|
48 |
|
|
uint32_t bad_size;
|
49 |
|
|
uint32_t sector_size;
|
50 |
|
|
uint32_t unchecked_size;
|
51 |
|
|
|
52 |
|
|
uint32_t nr_free_blocks;
|
53 |
|
|
uint32_t nr_erasing_blocks;
|
54 |
|
|
|
55 |
|
|
uint32_t nr_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 */
|
59 |
|
|
|
60 |
|
|
struct jffs2_eraseblock *gcblock; /* The block we're currently garbage-collecting */
|
61 |
|
|
|
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. */
|
73 |
|
|
|
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 */
|
77 |
|
|
|
78 |
|
|
wait_queue_head_t inocache_wq;
|
79 |
|
|
struct jffs2_inode_cache **inocache_list;
|
80 |
|
|
spinlock_t inocache_lock;
|
81 |
|
|
|
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;
|
86 |
|
|
|
87 |
|
|
/* Write-behind buffer for NAND flash */
|
88 |
|
|
unsigned char *wbuf;
|
89 |
|
|
uint32_t wbuf_ofs;
|
90 |
|
|
uint32_t wbuf_len;
|
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 */
|
94 |
|
|
|
95 |
|
|
/* OS-private pointer for getting back to master superblock info */
|
96 |
|
|
void *os_priv;
|
97 |
|
|
};
|
98 |
|
|
|
99 |
|
|
#endif /* _JFFS2_FB_SB */
|