aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/segment.c
diff options
context:
space:
mode:
authorJiro SEKIBA <jir@unicus.jp>2010-06-28 04:49:32 -0400
committerRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>2010-07-22 21:02:10 -0400
commitd26493b6f017c0b0063a15bf893411ddae85eee4 (patch)
tree994de3e7c0383f0e30e5e9c88c0c5d0261a834bc /fs/nilfs2/segment.c
parent60f46b7efc1d6b980511c2644cb89903062f6e98 (diff)
nilfs2: introduce nilfs_prepare_super
This function checks validity of super block pointers. If first super block is invalid, it will swap the super blocks. The function should be called before any super block information updates. Caller must obtain nilfs->ns_sem. Signed-off-by: Jiro SEKIBA <jir@unicus.jp> Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/segment.c')
-rw-r--r--fs/nilfs2/segment.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c
index 1f7881ca01c4..9e680a93b13a 100644
--- a/fs/nilfs2/segment.c
+++ b/fs/nilfs2/segment.c
@@ -2408,6 +2408,7 @@ static int nilfs_segctor_construct(struct nilfs_sc_info *sci, int mode)
2408{ 2408{
2409 struct nilfs_sb_info *sbi = sci->sc_sbi; 2409 struct nilfs_sb_info *sbi = sci->sc_sbi;
2410 struct the_nilfs *nilfs = sbi->s_nilfs; 2410 struct the_nilfs *nilfs = sbi->s_nilfs;
2411 struct nilfs_super_block **sbp;
2411 int err = 0; 2412 int err = 0;
2412 2413
2413 nilfs_segctor_accept(sci); 2414 nilfs_segctor_accept(sci);
@@ -2423,8 +2424,11 @@ static int nilfs_segctor_construct(struct nilfs_sc_info *sci, int mode)
2423 if (test_bit(NILFS_SC_SUPER_ROOT, &sci->sc_flags) && 2424 if (test_bit(NILFS_SC_SUPER_ROOT, &sci->sc_flags) &&
2424 nilfs_discontinued(nilfs)) { 2425 nilfs_discontinued(nilfs)) {
2425 down_write(&nilfs->ns_sem); 2426 down_write(&nilfs->ns_sem);
2426 err = nilfs_commit_super( 2427 err = -EIO;
2427 sbi, nilfs_altsb_need_update(nilfs)); 2428 sbp = nilfs_prepare_super(sbi);
2429 if (likely(sbp))
2430 err = nilfs_commit_super(
2431 sbi, nilfs_altsb_need_update(nilfs));
2428 up_write(&nilfs->ns_sem); 2432 up_write(&nilfs->ns_sem);
2429 } 2433 }
2430 } 2434 }