diff options
Diffstat (limited to 'fs/nilfs2/segment.c')
-rw-r--r-- | fs/nilfs2/segment.c | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 687d090cea34..55ebae5c7f39 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -504,17 +504,6 @@ static int nilfs_segctor_add_file_block(struct nilfs_sc_info *sci, | |||
504 | return err; | 504 | return err; |
505 | } | 505 | } |
506 | 506 | ||
507 | static int nilfs_handle_bmap_error(int err, const char *fname, | ||
508 | struct inode *inode, struct super_block *sb) | ||
509 | { | ||
510 | if (err == -EINVAL) { | ||
511 | nilfs_error(sb, fname, "broken bmap (inode=%lu)\n", | ||
512 | inode->i_ino); | ||
513 | err = -EIO; | ||
514 | } | ||
515 | return err; | ||
516 | } | ||
517 | |||
518 | /* | 507 | /* |
519 | * Callback functions that enumerate, mark, and collect dirty blocks | 508 | * Callback functions that enumerate, mark, and collect dirty blocks |
520 | */ | 509 | */ |
@@ -524,9 +513,8 @@ static int nilfs_collect_file_data(struct nilfs_sc_info *sci, | |||
524 | int err; | 513 | int err; |
525 | 514 | ||
526 | err = nilfs_bmap_propagate(NILFS_I(inode)->i_bmap, bh); | 515 | err = nilfs_bmap_propagate(NILFS_I(inode)->i_bmap, bh); |
527 | if (unlikely(err < 0)) | 516 | if (err < 0) |
528 | return nilfs_handle_bmap_error(err, __func__, inode, | 517 | return err; |
529 | sci->sc_super); | ||
530 | 518 | ||
531 | err = nilfs_segctor_add_file_block(sci, bh, inode, | 519 | err = nilfs_segctor_add_file_block(sci, bh, inode, |
532 | sizeof(struct nilfs_binfo_v)); | 520 | sizeof(struct nilfs_binfo_v)); |
@@ -539,13 +527,7 @@ static int nilfs_collect_file_node(struct nilfs_sc_info *sci, | |||
539 | struct buffer_head *bh, | 527 | struct buffer_head *bh, |
540 | struct inode *inode) | 528 | struct inode *inode) |
541 | { | 529 | { |
542 | int err; | 530 | return nilfs_bmap_propagate(NILFS_I(inode)->i_bmap, bh); |
543 | |||
544 | err = nilfs_bmap_propagate(NILFS_I(inode)->i_bmap, bh); | ||
545 | if (unlikely(err < 0)) | ||
546 | return nilfs_handle_bmap_error(err, __func__, inode, | ||
547 | sci->sc_super); | ||
548 | return 0; | ||
549 | } | 531 | } |
550 | 532 | ||
551 | static int nilfs_collect_file_bmap(struct nilfs_sc_info *sci, | 533 | static int nilfs_collect_file_bmap(struct nilfs_sc_info *sci, |
@@ -588,9 +570,8 @@ static int nilfs_collect_dat_data(struct nilfs_sc_info *sci, | |||
588 | int err; | 570 | int err; |
589 | 571 | ||
590 | err = nilfs_bmap_propagate(NILFS_I(inode)->i_bmap, bh); | 572 | err = nilfs_bmap_propagate(NILFS_I(inode)->i_bmap, bh); |
591 | if (unlikely(err < 0)) | 573 | if (err < 0) |
592 | return nilfs_handle_bmap_error(err, __func__, inode, | 574 | return err; |
593 | sci->sc_super); | ||
594 | 575 | ||
595 | err = nilfs_segctor_add_file_block(sci, bh, inode, sizeof(__le64)); | 576 | err = nilfs_segctor_add_file_block(sci, bh, inode, sizeof(__le64)); |
596 | if (!err) | 577 | if (!err) |
@@ -776,9 +757,8 @@ static int nilfs_test_metadata_dirty(struct the_nilfs *nilfs, | |||
776 | ret++; | 757 | ret++; |
777 | if (nilfs_mdt_fetch_dirty(nilfs->ns_sufile)) | 758 | if (nilfs_mdt_fetch_dirty(nilfs->ns_sufile)) |
778 | ret++; | 759 | ret++; |
779 | if (ret || nilfs_doing_gc()) | 760 | if ((ret || nilfs_doing_gc()) && nilfs_mdt_fetch_dirty(nilfs->ns_dat)) |
780 | if (nilfs_mdt_fetch_dirty(nilfs_dat_inode(nilfs))) | 761 | ret++; |
781 | ret++; | ||
782 | return ret; | 762 | return ret; |
783 | } | 763 | } |
784 | 764 | ||
@@ -814,7 +794,7 @@ static void nilfs_segctor_clear_metadata_dirty(struct nilfs_sc_info *sci) | |||
814 | nilfs_mdt_clear_dirty(sci->sc_root->ifile); | 794 | nilfs_mdt_clear_dirty(sci->sc_root->ifile); |
815 | nilfs_mdt_clear_dirty(nilfs->ns_cpfile); | 795 | nilfs_mdt_clear_dirty(nilfs->ns_cpfile); |
816 | nilfs_mdt_clear_dirty(nilfs->ns_sufile); | 796 | nilfs_mdt_clear_dirty(nilfs->ns_sufile); |
817 | nilfs_mdt_clear_dirty(nilfs_dat_inode(nilfs)); | 797 | nilfs_mdt_clear_dirty(nilfs->ns_dat); |
818 | } | 798 | } |
819 | 799 | ||
820 | static int nilfs_segctor_create_checkpoint(struct nilfs_sc_info *sci) | 800 | static int nilfs_segctor_create_checkpoint(struct nilfs_sc_info *sci) |
@@ -923,7 +903,7 @@ static void nilfs_segctor_fill_in_super_root(struct nilfs_sc_info *sci, | |||
923 | nilfs->ns_nongc_ctime : sci->sc_seg_ctime); | 903 | nilfs->ns_nongc_ctime : sci->sc_seg_ctime); |
924 | raw_sr->sr_flags = 0; | 904 | raw_sr->sr_flags = 0; |
925 | 905 | ||
926 | nilfs_write_inode_common(nilfs_dat_inode(nilfs), (void *)raw_sr + | 906 | nilfs_write_inode_common(nilfs->ns_dat, (void *)raw_sr + |
927 | NILFS_SR_DAT_OFFSET(isz), 1); | 907 | NILFS_SR_DAT_OFFSET(isz), 1); |
928 | nilfs_write_inode_common(nilfs->ns_cpfile, (void *)raw_sr + | 908 | nilfs_write_inode_common(nilfs->ns_cpfile, (void *)raw_sr + |
929 | NILFS_SR_CPFILE_OFFSET(isz), 1); | 909 | NILFS_SR_CPFILE_OFFSET(isz), 1); |
@@ -1179,7 +1159,7 @@ static int nilfs_segctor_collect_blocks(struct nilfs_sc_info *sci, int mode) | |||
1179 | sci->sc_stage.scnt++; /* Fall through */ | 1159 | sci->sc_stage.scnt++; /* Fall through */ |
1180 | case NILFS_ST_DAT: | 1160 | case NILFS_ST_DAT: |
1181 | dat_stage: | 1161 | dat_stage: |
1182 | err = nilfs_segctor_scan_file(sci, nilfs_dat_inode(nilfs), | 1162 | err = nilfs_segctor_scan_file(sci, nilfs->ns_dat, |
1183 | &nilfs_sc_dat_ops); | 1163 | &nilfs_sc_dat_ops); |
1184 | if (unlikely(err)) | 1164 | if (unlikely(err)) |
1185 | break; | 1165 | break; |
@@ -1563,7 +1543,6 @@ nilfs_segctor_update_payload_blocknr(struct nilfs_sc_info *sci, | |||
1563 | return 0; | 1543 | return 0; |
1564 | 1544 | ||
1565 | failed_bmap: | 1545 | failed_bmap: |
1566 | err = nilfs_handle_bmap_error(err, __func__, inode, sci->sc_super); | ||
1567 | return err; | 1546 | return err; |
1568 | } | 1547 | } |
1569 | 1548 | ||
@@ -1783,6 +1762,7 @@ static void nilfs_clear_copied_buffers(struct list_head *list, int err) | |||
1783 | if (!err) { | 1762 | if (!err) { |
1784 | set_buffer_uptodate(bh); | 1763 | set_buffer_uptodate(bh); |
1785 | clear_buffer_dirty(bh); | 1764 | clear_buffer_dirty(bh); |
1765 | clear_buffer_delay(bh); | ||
1786 | clear_buffer_nilfs_volatile(bh); | 1766 | clear_buffer_nilfs_volatile(bh); |
1787 | } | 1767 | } |
1788 | brelse(bh); /* for b_assoc_buffers */ | 1768 | brelse(bh); /* for b_assoc_buffers */ |
@@ -1909,6 +1889,7 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci) | |||
1909 | b_assoc_buffers) { | 1889 | b_assoc_buffers) { |
1910 | set_buffer_uptodate(bh); | 1890 | set_buffer_uptodate(bh); |
1911 | clear_buffer_dirty(bh); | 1891 | clear_buffer_dirty(bh); |
1892 | clear_buffer_delay(bh); | ||
1912 | clear_buffer_nilfs_volatile(bh); | 1893 | clear_buffer_nilfs_volatile(bh); |
1913 | clear_buffer_nilfs_redirected(bh); | 1894 | clear_buffer_nilfs_redirected(bh); |
1914 | if (bh == segbuf->sb_super_root) { | 1895 | if (bh == segbuf->sb_super_root) { |