Commit 26d815ad authored by Jaegeuk Kim's avatar Jaegeuk Kim

f2fs: introduce f2fs_commit_super

This patch introduces f2fs_commit_super to write updated superblock.
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 003a3e1d
...@@ -1535,6 +1535,7 @@ static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode) ...@@ -1535,6 +1535,7 @@ static inline int f2fs_add_link(struct dentry *dentry, struct inode *inode)
/* /*
* super.c * super.c
*/ */
int f2fs_commit_super(struct f2fs_sb_info *);
int f2fs_sync_fs(struct super_block *, int); int f2fs_sync_fs(struct super_block *, int);
extern __printf(3, 4) extern __printf(3, 4)
void f2fs_msg(struct super_block *, const char *, const char *, ...); void f2fs_msg(struct super_block *, const char *, const char *, ...);
......
...@@ -966,6 +966,30 @@ static int read_raw_super_block(struct super_block *sb, ...@@ -966,6 +966,30 @@ static int read_raw_super_block(struct super_block *sb,
return 0; 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) static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
{ {
struct f2fs_sb_info *sbi; struct f2fs_sb_info *sbi;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment