aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/the_nilfs.h
diff options
context:
space:
mode:
authorRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2009-04-06 22:01:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-07 11:31:20 -0400
commite339ad31f59925b48a92ee3947692fdf9758b8c7 (patch)
tree6bb85c43bfd100b0a220c788c654f2f74ca553e4 /fs/nilfs2/the_nilfs.h
parentcece552074c591970353ad48308d65f110aeaf28 (diff)
nilfs2: introduce secondary super block
The former versions didn't have extra super blocks. This improves the weak point by introducing another super block at unused region in tail of the partition. This doesn't break disk format compatibility; older versions just ingore the secondary super block, and new versions just recover it if it doesn't exist. The partition created by an old mkfs may not have unused region, but in that case, the secondary super block will not be added. This doesn't make more redundant copies of the super block; it is a future work. Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nilfs2/the_nilfs.h')
-rw-r--r--fs/nilfs2/the_nilfs.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/fs/nilfs2/the_nilfs.h b/fs/nilfs2/the_nilfs.h
index d750e48257c9..30fe58778d05 100644
--- a/fs/nilfs2/the_nilfs.h
+++ b/fs/nilfs2/the_nilfs.h
@@ -49,8 +49,10 @@ enum {
49 * @ns_sem: semaphore for shared states 49 * @ns_sem: semaphore for shared states
50 * @ns_writer_mutex: mutex protecting ns_writer attach/detach 50 * @ns_writer_mutex: mutex protecting ns_writer attach/detach
51 * @ns_writer_refcount: number of referrers on ns_writer 51 * @ns_writer_refcount: number of referrers on ns_writer
52 * @ns_sbh: buffer head of the on-disk super block 52 * @ns_sbh: buffer heads of on-disk super blocks
53 * @ns_sbp: pointer to the super block data 53 * @ns_sbp: pointers to super block data
54 * @ns_sbwtime: previous write time of super blocks
55 * @ns_sbsize: size of valid data in super block
54 * @ns_supers: list of nilfs super block structs 56 * @ns_supers: list of nilfs super block structs
55 * @ns_seg_seq: segment sequence counter 57 * @ns_seg_seq: segment sequence counter
56 * @ns_segnum: index number of the latest full segment. 58 * @ns_segnum: index number of the latest full segment.
@@ -101,8 +103,10 @@ struct the_nilfs {
101 * - protecting s_dirt in the super_block struct 103 * - protecting s_dirt in the super_block struct
102 * (see nilfs_write_super) and the following fields. 104 * (see nilfs_write_super) and the following fields.
103 */ 105 */
104 struct buffer_head *ns_sbh; 106 struct buffer_head *ns_sbh[2];
105 struct nilfs_super_block *ns_sbp; 107 struct nilfs_super_block *ns_sbp[2];
108 time_t ns_sbwtime[2];
109 unsigned ns_sbsize;
106 unsigned ns_mount_state; 110 unsigned ns_mount_state;
107 struct list_head ns_supers; 111 struct list_head ns_supers;
108 112
@@ -182,6 +186,10 @@ THE_NILFS_FNS(INIT, init)
182THE_NILFS_FNS(LOADED, loaded) 186THE_NILFS_FNS(LOADED, loaded)
183THE_NILFS_FNS(DISCONTINUED, discontinued) 187THE_NILFS_FNS(DISCONTINUED, discontinued)
184 188
189/* Minimum interval of periodical update of superblocks (in seconds) */
190#define NILFS_SB_FREQ 10
191#define NILFS_ALTSB_FREQ 60 /* spare superblock */
192
185void nilfs_set_last_segment(struct the_nilfs *, sector_t, u64, __u64); 193void nilfs_set_last_segment(struct the_nilfs *, sector_t, u64, __u64);
186struct the_nilfs *alloc_nilfs(struct block_device *); 194struct the_nilfs *alloc_nilfs(struct block_device *);
187void put_nilfs(struct the_nilfs *); 195void put_nilfs(struct the_nilfs *);
@@ -190,6 +198,8 @@ int load_nilfs(struct the_nilfs *, struct nilfs_sb_info *);
190int nilfs_count_free_blocks(struct the_nilfs *, sector_t *); 198int nilfs_count_free_blocks(struct the_nilfs *, sector_t *);
191int nilfs_checkpoint_is_mounted(struct the_nilfs *, __u64, int); 199int nilfs_checkpoint_is_mounted(struct the_nilfs *, __u64, int);
192int nilfs_near_disk_full(struct the_nilfs *); 200int nilfs_near_disk_full(struct the_nilfs *);
201void nilfs_fall_back_super_block(struct the_nilfs *);
202void nilfs_swap_super_block(struct the_nilfs *);
193 203
194 204
195static inline void get_nilfs(struct the_nilfs *nilfs) 205static inline void get_nilfs(struct the_nilfs *nilfs)