diff options
author | Jiro SEKIBA <jir@unicus.jp> | 2010-06-28 04:49:33 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-07-22 21:02:11 -0400 |
commit | b2ac86e1a8e3a3b0ab4449d062c582f07a078e7b (patch) | |
tree | b681ea820685a278e06995ff23b58f7a85904b70 /fs/nilfs2/nilfs.h | |
parent | d26493b6f017c0b0063a15bf893411ddae85eee4 (diff) |
nilfs2: sync super blocks in turns
This will sync super blocks in turns instead of syncing duplicate
super blocks at the time. This will help searching valid super root
when super block is written into disk before log is written, which is
happen when barrier-less block devices are unmounted uncleanly. In
the situation, old super block likely points to valid log.
This patch introduces ns_sbwcount member to the nilfs object and adds
nilfs_sb_will_flip() function; ns_sbwcount counts how many times super
blocks write back to the disk. And, nilfs_sb_will_flip() decides
whether flipping required or not based on the count of ns_sbwcount to
sync super blocks asymmetrically.
The following functions are also changed:
- nilfs_prepare_super(): flips super blocks according to the
argument. The argument is calculated by nilfs_sb_will_flip()
function.
- nilfs_cleanup_super(): sets "clean" flag to both super blocks if
they point to the same checkpoint.
To update both of super block information, caller of
nilfs_commit_super must set the information on both super blocks.
Signed-off-by: Jiro SEKIBA <jir@unicus.jp>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/nilfs.h')
-rw-r--r-- | fs/nilfs2/nilfs.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 462651061b03..36998eaab02f 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h | |||
@@ -107,6 +107,14 @@ enum { | |||
107 | }; | 107 | }; |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * commit flags for nilfs_commit_super and nilfs_sync_super | ||
111 | */ | ||
112 | enum { | ||
113 | NILFS_SB_COMMIT = 0, /* Commit a super block alternately */ | ||
114 | NILFS_SB_COMMIT_ALL /* Commit both super blocks */ | ||
115 | }; | ||
116 | |||
117 | /* | ||
110 | * Macros to check inode numbers | 118 | * Macros to check inode numbers |
111 | */ | 119 | */ |
112 | #define NILFS_MDT_INO_BITS \ | 120 | #define NILFS_MDT_INO_BITS \ |
@@ -272,7 +280,8 @@ extern int nilfs_store_magic_and_option(struct super_block *, | |||
272 | struct nilfs_super_block *, char *); | 280 | struct nilfs_super_block *, char *); |
273 | extern void nilfs_set_log_cursor(struct nilfs_super_block *, | 281 | extern void nilfs_set_log_cursor(struct nilfs_super_block *, |
274 | struct the_nilfs *); | 282 | struct the_nilfs *); |
275 | extern struct nilfs_super_block **nilfs_prepare_super(struct nilfs_sb_info *); | 283 | extern struct nilfs_super_block **nilfs_prepare_super(struct nilfs_sb_info *, |
284 | int flip); | ||
276 | extern int nilfs_commit_super(struct nilfs_sb_info *, int); | 285 | extern int nilfs_commit_super(struct nilfs_sb_info *, int); |
277 | extern int nilfs_cleanup_super(struct nilfs_sb_info *); | 286 | extern int nilfs_cleanup_super(struct nilfs_sb_info *); |
278 | extern int nilfs_attach_checkpoint(struct nilfs_sb_info *, __u64); | 287 | extern int nilfs_attach_checkpoint(struct nilfs_sb_info *, __u64); |