Skip to content

Commit

Permalink
nilfs2: use sb instance instead of nilfs_sb_info struct
Browse files Browse the repository at this point in the history
This replaces sbi uses with direct reference to sb instance.

Signed-off-by: Ryusuke Konishi <[email protected]>
  • Loading branch information
konis committed Mar 9, 2011
1 parent d96bbfa commit f754514
Show file tree
Hide file tree
Showing 7 changed files with 129 additions and 145 deletions.
10 changes: 5 additions & 5 deletions fs/nilfs2/nilfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ extern int nilfs_check_feature_compatibility(struct super_block *,
struct nilfs_super_block *);
extern void nilfs_set_log_cursor(struct nilfs_super_block *,
struct the_nilfs *);
extern struct nilfs_super_block **nilfs_prepare_super(struct nilfs_sb_info *,
int flip);
extern int nilfs_commit_super(struct nilfs_sb_info *, int);
extern int nilfs_cleanup_super(struct nilfs_sb_info *);
int nilfs_attach_checkpoint(struct nilfs_sb_info *sbi, __u64 cno, int curr_mnt,
struct nilfs_super_block **nilfs_prepare_super(struct super_block *sb,
int flip);
int nilfs_commit_super(struct super_block *sb, int flag);
int nilfs_cleanup_super(struct super_block *sb);
int nilfs_attach_checkpoint(struct super_block *sb, __u64 cno, int curr_mnt,
struct nilfs_root **root);
int nilfs_checkpoint_is_mounted(struct super_block *sb, __u64 cno);

Expand Down
32 changes: 16 additions & 16 deletions fs/nilfs2/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ void nilfs_dispose_segment_list(struct list_head *head)
}

static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs,
struct nilfs_sb_info *sbi,
struct super_block *sb,
struct nilfs_recovery_info *ri)
{
struct list_head *head = &ri->ri_used_segments;
Expand Down Expand Up @@ -501,7 +501,7 @@ static int nilfs_recovery_copy_block(struct the_nilfs *nilfs,
}

static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs,
struct nilfs_sb_info *sbi,
struct super_block *sb,
struct nilfs_root *root,
struct list_head *head,
unsigned long *nr_salvaged_blocks)
Expand All @@ -514,7 +514,7 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs,
int err = 0, err2 = 0;

list_for_each_entry_safe(rb, n, head, list) {
inode = nilfs_iget(sbi->s_super, root, rb->ino);
inode = nilfs_iget(sb, root, rb->ino);
if (IS_ERR(inode)) {
err = PTR_ERR(inode);
inode = NULL;
Expand Down Expand Up @@ -572,11 +572,11 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs,
* nilfs_do_roll_forward - salvage logical segments newer than the latest
* checkpoint
* @nilfs: nilfs object
* @sbi: nilfs_sb_info
* @sb: super block instance
* @ri: pointer to a nilfs_recovery_info
*/
static int nilfs_do_roll_forward(struct the_nilfs *nilfs,
struct nilfs_sb_info *sbi,
struct super_block *sb,
struct nilfs_root *root,
struct nilfs_recovery_info *ri)
{
Expand Down Expand Up @@ -648,7 +648,7 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs,
goto failed;
if (flags & NILFS_SS_LOGEND) {
err = nilfs_recover_dsync_blocks(
nilfs, sbi, root, &dsync_blocks,
nilfs, sb, root, &dsync_blocks,
&nsalvaged_blocks);
if (unlikely(err))
goto failed;
Expand Down Expand Up @@ -681,7 +681,7 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs,

if (nsalvaged_blocks) {
printk(KERN_INFO "NILFS (device %s): salvaged %lu blocks\n",
sbi->s_super->s_id, nsalvaged_blocks);
sb->s_id, nsalvaged_blocks);
ri->ri_need_recovery = NILFS_RECOVERY_ROLLFORWARD_DONE;
}
out:
Expand All @@ -695,7 +695,7 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs,
printk(KERN_ERR
"NILFS (device %s): Error roll-forwarding "
"(err=%d, pseg block=%llu). ",
sbi->s_super->s_id, err, (unsigned long long)pseg_start);
sb->s_id, err, (unsigned long long)pseg_start);
goto out;
}

Expand Down Expand Up @@ -724,7 +724,7 @@ static void nilfs_finish_roll_forward(struct the_nilfs *nilfs,
/**
* nilfs_salvage_orphan_logs - salvage logs written after the latest checkpoint
* @nilfs: nilfs object
* @sbi: nilfs_sb_info
* @sb: super block instance
* @ri: pointer to a nilfs_recovery_info struct to store search results.
*
* Return Value: On success, 0 is returned. On error, one of the following
Expand All @@ -741,7 +741,7 @@ static void nilfs_finish_roll_forward(struct the_nilfs *nilfs,
* %-ENOMEM - Insufficient memory available.
*/
int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,
struct nilfs_sb_info *sbi,
struct super_block *sb,
struct nilfs_recovery_info *ri)
{
struct nilfs_root *root;
Expand All @@ -750,32 +750,32 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs,
if (ri->ri_lsegs_start == 0 || ri->ri_lsegs_end == 0)
return 0;

err = nilfs_attach_checkpoint(sbi, ri->ri_cno, true, &root);
err = nilfs_attach_checkpoint(sb, ri->ri_cno, true, &root);
if (unlikely(err)) {
printk(KERN_ERR
"NILFS: error loading the latest checkpoint.\n");
return err;
}

err = nilfs_do_roll_forward(nilfs, sbi, root, ri);
err = nilfs_do_roll_forward(nilfs, sb, root, ri);
if (unlikely(err))
goto failed;

if (ri->ri_need_recovery == NILFS_RECOVERY_ROLLFORWARD_DONE) {
err = nilfs_prepare_segment_for_recovery(nilfs, sbi, ri);
err = nilfs_prepare_segment_for_recovery(nilfs, sb, ri);
if (unlikely(err)) {
printk(KERN_ERR "NILFS: Error preparing segments for "
"recovery.\n");
goto failed;
}

err = nilfs_attach_segment_constructor(sbi, root);
err = nilfs_attach_log_writer(sb, root);
if (unlikely(err))
goto failed;

set_nilfs_discontinued(nilfs);
err = nilfs_construct_segment(sbi->s_super);
nilfs_detach_segment_constructor(sbi);
err = nilfs_construct_segment(sb);
nilfs_detach_log_writer(sb);

if (unlikely(err)) {
printk(KERN_ERR "NILFS: Oops! recovery failed. "
Expand Down
Loading

0 comments on commit f754514

Please sign in to comment.