diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-08-25 04:45:44 -0400 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2010-10-22 20:24:34 -0400 |
commit | 4d8d9293dce503eb0e083e17a02a328d397e7f00 (patch) | |
tree | ffa2dce7f100b1346131adc01cf93e280b225509 /fs/nilfs2/recovery.c | |
parent | ba65ae4729bf81c58d9fc847f67d57eec525b042 (diff) |
nilfs2: set pointer to root object in inodes
This puts a pointer to nilfs_root object in the private part of
on-memory inode, and makes nilfs_iget function pick up the inode with
the same root object.
Non-root inodes inherit its nilfs_root object from parent inode. That
of the root inode is allocated through nilfs_attach_checkpoint()
function.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/recovery.c')
-rw-r--r-- | fs/nilfs2/recovery.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/nilfs2/recovery.c b/fs/nilfs2/recovery.c index d0c35ef39f6a..a9a5ba8f57d5 100644 --- a/fs/nilfs2/recovery.c +++ b/fs/nilfs2/recovery.c | |||
@@ -504,6 +504,7 @@ static int nilfs_recovery_copy_block(struct the_nilfs *nilfs, | |||
504 | 504 | ||
505 | static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, | 505 | static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, |
506 | struct nilfs_sb_info *sbi, | 506 | struct nilfs_sb_info *sbi, |
507 | struct nilfs_root *root, | ||
507 | struct list_head *head, | 508 | struct list_head *head, |
508 | unsigned long *nr_salvaged_blocks) | 509 | unsigned long *nr_salvaged_blocks) |
509 | { | 510 | { |
@@ -515,7 +516,7 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, | |||
515 | int err = 0, err2 = 0; | 516 | int err = 0, err2 = 0; |
516 | 517 | ||
517 | list_for_each_entry_safe(rb, n, head, list) { | 518 | list_for_each_entry_safe(rb, n, head, list) { |
518 | inode = nilfs_iget(sbi->s_super, rb->ino); | 519 | inode = nilfs_iget(sbi->s_super, root, rb->ino); |
519 | if (IS_ERR(inode)) { | 520 | if (IS_ERR(inode)) { |
520 | err = PTR_ERR(inode); | 521 | err = PTR_ERR(inode); |
521 | inode = NULL; | 522 | inode = NULL; |
@@ -578,6 +579,7 @@ static int nilfs_recover_dsync_blocks(struct the_nilfs *nilfs, | |||
578 | */ | 579 | */ |
579 | static int nilfs_do_roll_forward(struct the_nilfs *nilfs, | 580 | static int nilfs_do_roll_forward(struct the_nilfs *nilfs, |
580 | struct nilfs_sb_info *sbi, | 581 | struct nilfs_sb_info *sbi, |
582 | struct nilfs_root *root, | ||
581 | struct nilfs_recovery_info *ri) | 583 | struct nilfs_recovery_info *ri) |
582 | { | 584 | { |
583 | struct buffer_head *bh_sum = NULL; | 585 | struct buffer_head *bh_sum = NULL; |
@@ -649,7 +651,7 @@ static int nilfs_do_roll_forward(struct the_nilfs *nilfs, | |||
649 | goto failed; | 651 | goto failed; |
650 | if (flags & NILFS_SS_LOGEND) { | 652 | if (flags & NILFS_SS_LOGEND) { |
651 | err = nilfs_recover_dsync_blocks( | 653 | err = nilfs_recover_dsync_blocks( |
652 | nilfs, sbi, &dsync_blocks, | 654 | nilfs, sbi, root, &dsync_blocks, |
653 | &nsalvaged_blocks); | 655 | &nsalvaged_blocks); |
654 | if (unlikely(err)) | 656 | if (unlikely(err)) |
655 | goto failed; | 657 | goto failed; |
@@ -746,19 +748,20 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs, | |||
746 | struct nilfs_sb_info *sbi, | 748 | struct nilfs_sb_info *sbi, |
747 | struct nilfs_recovery_info *ri) | 749 | struct nilfs_recovery_info *ri) |
748 | { | 750 | { |
751 | struct nilfs_root *root; | ||
749 | int err; | 752 | int err; |
750 | 753 | ||
751 | if (ri->ri_lsegs_start == 0 || ri->ri_lsegs_end == 0) | 754 | if (ri->ri_lsegs_start == 0 || ri->ri_lsegs_end == 0) |
752 | return 0; | 755 | return 0; |
753 | 756 | ||
754 | err = nilfs_attach_checkpoint(sbi, ri->ri_cno); | 757 | err = nilfs_attach_checkpoint(sbi, ri->ri_cno, true, &root); |
755 | if (unlikely(err)) { | 758 | if (unlikely(err)) { |
756 | printk(KERN_ERR | 759 | printk(KERN_ERR |
757 | "NILFS: error loading the latest checkpoint.\n"); | 760 | "NILFS: error loading the latest checkpoint.\n"); |
758 | return err; | 761 | return err; |
759 | } | 762 | } |
760 | 763 | ||
761 | err = nilfs_do_roll_forward(nilfs, sbi, ri); | 764 | err = nilfs_do_roll_forward(nilfs, sbi, root, ri); |
762 | if (unlikely(err)) | 765 | if (unlikely(err)) |
763 | goto failed; | 766 | goto failed; |
764 | 767 | ||
@@ -789,6 +792,7 @@ int nilfs_salvage_orphan_logs(struct the_nilfs *nilfs, | |||
789 | 792 | ||
790 | failed: | 793 | failed: |
791 | nilfs_detach_checkpoint(sbi); | 794 | nilfs_detach_checkpoint(sbi); |
795 | nilfs_put_root(root); | ||
792 | return err; | 796 | return err; |
793 | } | 797 | } |
794 | 798 | ||