Merge git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
[firefly-linux-kernel-4.4.55.git] / fs / nilfs2 / recovery.c
index 3dfcd3b7d3891a030ea8dd7a01c0a51a73aea0bf..ba4a64518f389d6dcad64830050d4fdf635746a8 100644 (file)
@@ -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;
@@ -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)
@@ -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;
@@ -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)
 {
@@ -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;
@@ -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:
@@ -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;
 }
 
@@ -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
@@ -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;
@@ -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. "