Blame view

fs/jffs2/jffs2_fs_sb.h 5.23 KB
c00c310ea   David Woodhouse   [JFFS2] Tidy up l...
1
2
3
4
  /*
   * JFFS2 -- Journalling Flash File System, Version 2.
   *
   * Copyright © 2001-2007 Red Hat, Inc.
6088c0587   David Woodhouse   jffs2: Update cop...
5
   * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
c00c310ea   David Woodhouse   [JFFS2] Tidy up l...
6
7
8
9
10
11
   *
   * Created by David Woodhouse <dwmw2@infradead.org>
   *
   * For licensing information, see the file 'LICENCE' in this directory.
   *
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
12
13
14
15
16
17
18
19
  
  #ifndef _JFFS2_FS_SB
  #define _JFFS2_FS_SB
  
  #include <linux/types.h>
  #include <linux/spinlock.h>
  #include <linux/workqueue.h>
  #include <linux/completion.h>
ced220703   David Woodhouse   [JFFS2] semaphore...
20
  #include <linux/mutex.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
22
23
24
25
26
  #include <linux/timer.h>
  #include <linux/wait.h>
  #include <linux/list.h>
  #include <linux/rwsem.h>
  
  #define JFFS2_SB_FLAG_RO 1
31fbdf7aa   Artem B. Bityuckiy   [JFFS2] Fix NOR s...
27
28
  #define JFFS2_SB_FLAG_SCANNING 2 /* Flash scanning is in progress */
  #define JFFS2_SB_FLAG_BUILDING 4 /* File system building is in progress */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
29
30
  
  struct jffs2_inodirty;
92abc475d   Andres Salomon   jffs2: implement ...
31
32
33
34
  struct jffs2_mount_opts {
  	bool override_compr;
  	unsigned int compr;
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
35
  /* A struct for the overall file system control.  Pointers to
182ec4eee   Thomas Gleixner   [JFFS2] Clean up ...
36
     jffs2_sb_info structs are named `c' in the source code.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
37
38
39
40
41
42
43
44
45
46
47
     Nee jffs_control
  */
  struct jffs2_sb_info {
  	struct mtd_info *mtd;
  
  	uint32_t highest_ino;
  	uint32_t checked_ino;
  
  	unsigned int flags;
  
  	struct task_struct *gc_task;	/* GC task struct */
fff7afd79   Thomas Gleixner   [JFFS2] Convert t...
48
  	struct completion gc_thread_start; /* GC thread start completion */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
49
  	struct completion gc_thread_exit; /* GC thread exit completion port */
ced220703   David Woodhouse   [JFFS2] semaphore...
50
  	struct mutex alloc_sem;		/* Used to protect all the following
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
  					   fields, and also to protect against
  					   out-of-order writing of nodes. And GC. */
  	uint32_t cleanmarker_size;	/* Size of an _inline_ CLEANMARKER
  					 (i.e. zero for OOB CLEANMARKER */
  
  	uint32_t flash_size;
  	uint32_t used_size;
  	uint32_t dirty_size;
  	uint32_t wasted_size;
  	uint32_t free_size;
  	uint32_t erasing_size;
  	uint32_t bad_size;
  	uint32_t sector_size;
  	uint32_t unchecked_size;
  
  	uint32_t nr_free_blocks;
  	uint32_t nr_erasing_blocks;
  
  	/* Number of free blocks there must be before we... */
  	uint8_t resv_blocks_write;	/* ... allow a normal filesystem write */
  	uint8_t resv_blocks_deletion;	/* ... allow a normal filesystem deletion */
  	uint8_t resv_blocks_gctrigger;	/* ... wake up the GC thread */
  	uint8_t resv_blocks_gcbad;	/* ... pick a block from the bad_list to GC */
  	uint8_t resv_blocks_gcmerge;	/* ... merge pages when garbage collecting */
8fb870df5   David Woodhouse   [JFFS2] Trigger g...
75
76
  	/* Number of 'very dirty' blocks before we trigger immediate GC */
  	uint8_t vdirty_blocks_gctrigger;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
77
78
79
80
  
  	uint32_t nospc_dirty_size;
  
  	uint32_t nr_blocks;
182ec4eee   Thomas Gleixner   [JFFS2] Clean up ...
81
  	struct jffs2_eraseblock *blocks;	/* The whole array of blocks. Used for getting blocks
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
82
83
84
85
86
87
88
89
90
91
92
  						 * from the offset (blocks[ofs / sector_size]) */
  	struct jffs2_eraseblock *nextblock;	/* The block we're currently filling */
  
  	struct jffs2_eraseblock *gcblock;	/* The block we're currently garbage-collecting */
  
  	struct list_head clean_list;		/* Blocks 100% full of clean data */
  	struct list_head very_dirty_list;	/* Blocks with lots of dirty space */
  	struct list_head dirty_list;		/* Blocks with some dirty space */
  	struct list_head erasable_list;		/* Blocks which are completely dirty, and need erasing */
  	struct list_head erasable_pending_wbuf_list;	/* Blocks which need erasing but only after the current wbuf is flushed */
  	struct list_head erasing_list;		/* Blocks which are currently erasing */
e2bc322bf   David Woodhouse   [JFFS2] Add erase...
93
  	struct list_head erase_checking_list;	/* Blocks which are being checked and marked */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
94
95
96
97
98
  	struct list_head erase_pending_list;	/* Blocks which need erasing now */
  	struct list_head erase_complete_list;	/* Blocks which are erased and need the clean marker written to them */
  	struct list_head free_list;		/* Blocks which are free and ready to be used */
  	struct list_head bad_list;		/* Bad blocks. */
  	struct list_head bad_used_list;		/* Bad blocks with valid data in. */
182ec4eee   Thomas Gleixner   [JFFS2] Clean up ...
99
  	spinlock_t erase_completion_lock;	/* Protect free_list and erasing_list
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
100
101
102
103
  						   against erase completion handler */
  	wait_queue_head_t erase_wait;		/* For waiting for erases to complete */
  
  	wait_queue_head_t inocache_wq;
65e5a0e18   Daniel Drake   jffs2: Dynamicall...
104
  	int inocache_hashsize;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
105
106
  	struct jffs2_inode_cache **inocache_list;
  	spinlock_t inocache_lock;
182ec4eee   Thomas Gleixner   [JFFS2] Clean up ...
107

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
108
  	/* Sem to allow jffs2_garbage_collect_deletion_dirent to
182ec4eee   Thomas Gleixner   [JFFS2] Clean up ...
109
  	   drop the erase_completion_lock while it's holding a pointer
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
110
  	   to an obsoleted node. I don't like this. Alternatives welcomed. */
ced220703   David Woodhouse   [JFFS2] semaphore...
111
  	struct mutex erase_free_sem;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
112

733802d97   Artem B. Bityutskiy   [JFFS2] Debug cod...
113
  	uint32_t wbuf_pagesize; /* 0 for NOR and other flashes with no wbuf */
182ec4eee   Thomas Gleixner   [JFFS2] Clean up ...
114

a6bc432e2   David Woodhouse   [JFFS2] Add suppo...
115
116
117
  #ifdef CONFIG_JFFS2_FS_WBUF_VERIFY
  	unsigned char *wbuf_verify; /* read-back buffer for verification */
  #endif
2f82ce1eb   Andrew Victor   [JFFS2] Use a sin...
118
  #ifdef CONFIG_JFFS2_FS_WRITEBUFFER
a7a6ace14   Artem Bityutskiy   [JFFS2] Use MTD_O...
119
  	unsigned char *wbuf; /* Write-behind buffer for NAND flash */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
120
121
  	uint32_t wbuf_ofs;
  	uint32_t wbuf_len;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
122
  	struct jffs2_inodirty *wbuf_inodes;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
123
  	struct rw_semaphore wbuf_sem;	/* Protects the write buffer */
a7a6ace14   Artem Bityutskiy   [JFFS2] Use MTD_O...
124
125
  	unsigned char *oobbuf;
  	int oobavail; /* How many bytes are available for JFFS2 in OOB */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
126
  #endif
e631ddba5   Ferenc Havasi   [JFFS2] Add erase...
127
  	struct jffs2_summary *summary;		/* Summary information */
92abc475d   Andres Salomon   jffs2: implement ...
128
  	struct jffs2_mount_opts mount_opts;
e631ddba5   Ferenc Havasi   [JFFS2] Add erase...
129

aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
130
131
132
  #ifdef CONFIG_JFFS2_FS_XATTR
  #define XATTRINDEX_HASHSIZE	(57)
  	uint32_t highest_xid;
c9f700f84   KaiGai Kohei   [JFFS2][XATTR] us...
133
  	uint32_t highest_xseqno;
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
134
  	struct list_head xattrindex[XATTRINDEX_HASHSIZE];
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
135
  	struct list_head xattr_unchecked;
c9f700f84   KaiGai Kohei   [JFFS2][XATTR] us...
136
137
  	struct list_head xattr_dead_list;
  	struct jffs2_xattr_ref *xref_dead_list;
8f2b6f49c   KaiGai Kohei   [JFFS2][XATTR] Re...
138
  	struct jffs2_xattr_ref *xref_temp;
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
139
140
141
142
  	struct rw_semaphore xattr_sem;
  	uint32_t xdatum_mem_usage;
  	uint32_t xdatum_mem_threshold;
  #endif
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
143
144
145
  	/* OS-private pointer for getting back to master superblock info */
  	void *os_priv;
  };
027d9ac2c   Dan Carpenter   jffs2: typo in co...
146
  #endif /* _JFFS2_FS_SB */