diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-04-20 18:49:51 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-05-28 15:41:29 -0700 |
commit | 26d815ad75156a1cf2f6c7ba94cdfd32849879d7 (patch) | |
tree | 88a639a11bd7eaf2b65863245254d8fc139aeca8 /fs/f2fs/super.c | |
parent | 003a3e1d60b0bb5cfb4feffb05a2083db2346364 (diff) |
f2fs: introduce f2fs_commit_super
This patch introduces f2fs_commit_super to write updated superblock.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r-- | fs/f2fs/super.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index b2dd1b01f076..85841687b40a 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -966,6 +966,30 @@ retry: return 0; } +int f2fs_commit_super(struct f2fs_sb_info *sbi) +{ + struct buffer_head *sbh = sbi->raw_super_buf; + sector_t block = sbh->b_blocknr; + int err; + + /* write back-up superblock first */ + sbh->b_blocknr = block ? 0 : 1; + mark_buffer_dirty(sbh); + err = sync_dirty_buffer(sbh); + + sbh->b_blocknr = block; + if (err) + goto out; + + /* write current valid superblock */ + mark_buffer_dirty(sbh); + err = sync_dirty_buffer(sbh); +out: + clear_buffer_write_io_error(sbh); + set_buffer_uptodate(sbh); + return err; +} + static int f2fs_fill_super(struct super_block *sb, void *data, int silent) { struct f2fs_sb_info *sbi; |