• Home
  • Raw
  • Download

Lines Matching refs:fs

42 	init_resource_track(&rtrack, ctx->fs->io);  in e2fsck_pass5()
49 if ((ctx->progress)(ctx, 5, 0, ctx->fs->group_desc_count*2)) in e2fsck_pass5()
79 print_resource_track(ctx, _("Pass 5"), &rtrack, ctx->fs->io); in e2fsck_pass5()
91 if (!ext2fs_has_feature_metadata_csum(ctx->fs->super)) in check_inode_bitmap_checksum()
95 if (ext2fs_test_ib_dirty(ctx->fs)) in check_inode_bitmap_checksum()
98 nbytes = (size_t)(EXT2_INODES_PER_GROUP(ctx->fs->super) / 8); in check_inode_bitmap_checksum()
99 retval = ext2fs_get_mem(ctx->fs->blocksize, &buf); in check_inode_bitmap_checksum()
107 for (i = 0; i < ctx->fs->group_desc_count; i++) { in check_inode_bitmap_checksum()
108 if (ext2fs_bg_flags_test(ctx->fs, i, EXT2_BG_INODE_UNINIT)) in check_inode_bitmap_checksum()
112 retval = ext2fs_get_inode_bitmap_range2(ctx->fs->inode_map, in check_inode_bitmap_checksum()
118 if (ext2fs_inode_bitmap_csum_verify(ctx->fs, i, buf, nbytes)) in check_inode_bitmap_checksum()
129 ext2fs_mark_ib_dirty(ctx->fs); in check_inode_bitmap_checksum()
145 if (!ext2fs_has_feature_metadata_csum(ctx->fs->super)) in check_block_bitmap_checksum()
149 if (ext2fs_test_bb_dirty(ctx->fs)) in check_block_bitmap_checksum()
152 nbytes = (size_t)(EXT2_CLUSTERS_PER_GROUP(ctx->fs->super) / 8); in check_block_bitmap_checksum()
153 retval = ext2fs_get_mem(ctx->fs->blocksize, &buf); in check_block_bitmap_checksum()
161 for (i = 0; i < ctx->fs->group_desc_count; i++) { in check_block_bitmap_checksum()
162 if (ext2fs_bg_flags_test(ctx->fs, i, EXT2_BG_BLOCK_UNINIT)) in check_block_bitmap_checksum()
165 blk_itr = EXT2FS_B2C(ctx->fs, in check_block_bitmap_checksum()
166 ctx->fs->super->s_first_data_block) + in check_block_bitmap_checksum()
168 retval = ext2fs_get_block_bitmap_range2(ctx->fs->block_map, in check_block_bitmap_checksum()
174 if (ext2fs_block_bitmap_csum_verify(ctx->fs, i, buf, nbytes)) in check_block_bitmap_checksum()
185 ext2fs_mark_bb_dirty(ctx->fs); in check_block_bitmap_checksum()
195 ext2_filsys fs = ctx->fs; in e2fsck_discard_blocks() local
203 if (ext2fs_test_changed(fs)) in e2fsck_discard_blocks()
207 (io_channel_discard(fs->io, start, count))) in e2fsck_discard_blocks()
220 ext2_filsys fs = ctx->fs; in e2fsck_discard_inodes() local
226 if ((start < 1) || (start > EXT2_INODES_PER_GROUP(fs->super))) { in e2fsck_discard_inodes()
244 !io_channel_discard_zeroes_data(fs->io)) in e2fsck_discard_inodes()
258 EXT2_INODES_PER_BLOCK(fs->super)); in e2fsck_discard_inodes()
259 count -= (blk * EXT2_INODES_PER_BLOCK(fs->super) - start); in e2fsck_discard_inodes()
260 blk += ext2fs_inode_table_loc(fs, group); in e2fsck_discard_inodes()
261 num = count / EXT2_INODES_PER_BLOCK(fs->super); in e2fsck_discard_inodes()
304 #define B2C(x) EXT2FS_B2C(fs, (x))
311 ext2_filsys fs = ctx->fs; in check_block_bitmaps() local
317 blk64_t first_free = ext2fs_blocks_count(fs->super); in check_block_bitmaps()
327 actual_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize, in check_block_bitmaps()
329 bitmap_buf = (char *) e2fsck_allocate_memory(ctx, fs->blocksize, in check_block_bitmaps()
334 fs->group_desc_count * sizeof(unsigned int), "free block count array"); in check_block_bitmaps()
336 if ((B2C(fs->super->s_first_data_block) < in check_block_bitmaps()
338 (B2C(ext2fs_blocks_count(fs->super)-1) > in check_block_bitmaps()
341 pctx.blk = B2C(fs->super->s_first_data_block); in check_block_bitmaps()
342 pctx.blk2 = B2C(ext2fs_blocks_count(fs->super) - 1); in check_block_bitmaps()
351 if ((B2C(fs->super->s_first_data_block) < in check_block_bitmaps()
352 ext2fs_get_block_bitmap_start2(fs->block_map)) || in check_block_bitmaps()
353 (B2C(ext2fs_blocks_count(fs->super)-1) > in check_block_bitmaps()
354 ext2fs_get_block_bitmap_end2(fs->block_map))) { in check_block_bitmaps()
356 pctx.blk = B2C(fs->super->s_first_data_block); in check_block_bitmaps()
357 pctx.blk2 = B2C(ext2fs_blocks_count(fs->super) - 1); in check_block_bitmaps()
358 pctx.ino = ext2fs_get_block_bitmap_start2(fs->block_map); in check_block_bitmaps()
359 pctx.ino2 = ext2fs_get_block_bitmap_end2(fs->block_map); in check_block_bitmaps()
370 for (i = B2C(fs->super->s_first_data_block); in check_block_bitmaps()
371 i < ext2fs_blocks_count(fs->super); in check_block_bitmaps()
372 i += EXT2FS_CLUSTER_RATIO(fs)) { in check_block_bitmaps()
374 B2C(fs->super->s_first_data_block)) % in check_block_bitmaps()
375 fs->super->s_clusters_per_group == 0; in check_block_bitmaps()
376 int n, nbytes = fs->super->s_clusters_per_group / 8; in check_block_bitmaps()
391 (group == fs->group_desc_count - 1) || in check_block_bitmaps()
396 B2C(i), fs->super->s_clusters_per_group, in check_block_bitmaps()
400 retval = ext2fs_get_block_bitmap_range2(fs->block_map, in check_block_bitmaps()
401 B2C(i), fs->super->s_clusters_per_group, in check_block_bitmaps()
408 group_free = fs->super->s_clusters_per_group - n; in check_block_bitmaps()
410 i += EXT2FS_C2B(fs, fs->super->s_clusters_per_group - 1); in check_block_bitmaps()
417 bitmap = ext2fs_fast_test_block_bitmap2(fs->block_map, i); in check_block_bitmaps()
433 if (ext2fs_bg_flags_test(fs, group, in check_block_bitmaps()
440 ext2fs_bg_flags_clear(fs, group, in check_block_bitmaps()
449 (pctx.blk2 == i - EXT2FS_CLUSTER_RATIO(fs))) in check_block_bitmaps()
450 pctx.blk2 += EXT2FS_CLUSTER_RATIO(fs); in check_block_bitmaps()
475 first_free = ext2fs_blocks_count(fs->super); in check_block_bitmaps()
478 if ((blocks == fs->super->s_clusters_per_group) || in check_block_bitmaps()
479 (EXT2FS_B2C(fs, i) == in check_block_bitmaps()
480 EXT2FS_B2C(fs, ext2fs_blocks_count(fs->super)-1))) { in check_block_bitmaps()
489 first_free = ext2fs_blocks_count(fs->super); in check_block_bitmaps()
497 fs->group_desc_count*2)) in check_block_bitmaps()
510 ext2fs_free_block_bitmap(fs->block_map); in check_block_bitmaps()
512 &fs->block_map); in check_block_bitmaps()
519 ext2fs_set_bitmap_padding(fs->block_map); in check_block_bitmaps()
520 ext2fs_mark_bb_dirty(fs); in check_block_bitmaps()
524 memset(free_array, 0, fs->group_desc_count * sizeof(int)); in check_block_bitmaps()
528 ext2fs_unmark_valid(fs); in check_block_bitmaps()
530 for (g = 0; g < fs->group_desc_count; g++) { in check_block_bitmaps()
531 if (free_array[g] != ext2fs_bg_free_blocks_count(fs, g)) { in check_block_bitmaps()
533 pctx.blk = ext2fs_bg_free_blocks_count(fs, g); in check_block_bitmaps()
538 ext2fs_bg_free_blocks_count_set(fs, g, free_array[g]); in check_block_bitmaps()
539 ext2fs_mark_super_dirty(fs); in check_block_bitmaps()
541 ext2fs_unmark_valid(fs); in check_block_bitmaps()
544 free_blocks = EXT2FS_C2B(fs, free_blocks); in check_block_bitmaps()
545 if (free_blocks != ext2fs_free_blocks_count(fs->super)) { in check_block_bitmaps()
547 pctx.blk = ext2fs_free_blocks_count(fs->super); in check_block_bitmaps()
551 ext2fs_free_blocks_count_set(fs->super, free_blocks); in check_block_bitmaps()
552 ext2fs_mark_super_dirty(fs); in check_block_bitmaps()
563 ext2_filsys fs = ctx->fs; in check_inode_bitmaps() local
580 ext2_ino_t first_free = fs->super->s_inodes_per_group + 1; in check_inode_bitmaps()
584 fs->group_desc_count * sizeof(ext2_ino_t), "free inode count array"); in check_inode_bitmaps()
587 fs->group_desc_count * sizeof(ext2_ino_t), "directory count array"); in check_inode_bitmaps()
590 (fs->super->s_inodes_count > in check_inode_bitmaps()
594 pctx.blk2 = fs->super->s_inodes_count; in check_inode_bitmaps()
602 if ((1 < ext2fs_get_inode_bitmap_start2(fs->inode_map)) || in check_inode_bitmaps()
603 (fs->super->s_inodes_count > in check_inode_bitmaps()
604 ext2fs_get_inode_bitmap_end2(fs->inode_map))) { in check_inode_bitmaps()
607 pctx.blk2 = fs->super->s_inodes_count; in check_inode_bitmaps()
608 pctx.ino = ext2fs_get_inode_bitmap_start2(fs->inode_map); in check_inode_bitmaps()
609 pctx.ino2 = ext2fs_get_inode_bitmap_end2(fs->inode_map); in check_inode_bitmaps()
616 csum_flag = ext2fs_has_group_desc_csum(fs); in check_inode_bitmaps()
622 (ext2fs_bg_flags_test(fs, group, EXT2_BG_INODE_UNINIT))) in check_inode_bitmaps()
626 for (i = 1; i <= fs->super->s_inodes_count && i > 0; i++) { in check_inode_bitmaps()
629 i % fs->super->s_inodes_per_group == 1) { in check_inode_bitmaps()
636 fs->super->s_inodes_per_group)) { in check_inode_bitmaps()
643 inodes = fs->super->s_inodes_per_group - 1; in check_inode_bitmaps()
656 bitmap = ext2fs_fast_test_inode_bitmap2(fs->inode_map, i); in check_inode_bitmaps()
680 ext2fs_bg_flags_clear(fs, group, EXT2_BG_INODE_UNINIT); in check_inode_bitmaps()
714 first_free = fs->super->s_inodes_per_group + 1; in check_inode_bitmaps()
723 if ((inodes == fs->super->s_inodes_per_group) || in check_inode_bitmaps()
724 (i == fs->super->s_inodes_count)) { in check_inode_bitmaps()
736 io_channel_discard_zeroes_data(fs->io) && in check_inode_bitmaps()
737 !(ext2fs_bg_flags_test(fs, group, in check_inode_bitmaps()
739 ext2fs_bg_flags_set(fs, group, in check_inode_bitmaps()
741 ext2fs_group_desc_csum_set(fs, group); in check_inode_bitmaps()
744 first_free = fs->super->s_inodes_per_group + 1; in check_inode_bitmaps()
754 group + fs->group_desc_count, in check_inode_bitmaps()
755 fs->group_desc_count*2)) in check_inode_bitmaps()
758 (i != fs->super->s_inodes_count) && in check_inode_bitmaps()
759 (ext2fs_bg_flags_test(fs, group, EXT2_BG_INODE_UNINIT) in check_inode_bitmaps()
774 ext2fs_free_inode_bitmap(fs->inode_map); in check_inode_bitmaps()
776 &fs->inode_map); in check_inode_bitmaps()
783 ext2fs_set_bitmap_padding(fs->inode_map); in check_inode_bitmaps()
784 ext2fs_mark_ib_dirty(fs); in check_inode_bitmaps()
789 memset(free_array, 0, fs->group_desc_count * sizeof(int)); in check_inode_bitmaps()
790 memset(dir_array, 0, fs->group_desc_count * sizeof(int)); in check_inode_bitmaps()
794 ext2fs_unmark_valid(fs); in check_inode_bitmaps()
796 for (i = 0; i < fs->group_desc_count; i++) { in check_inode_bitmaps()
797 if (free_array[i] != ext2fs_bg_free_inodes_count(fs, i)) { in check_inode_bitmaps()
799 pctx.ino = ext2fs_bg_free_inodes_count(fs, i); in check_inode_bitmaps()
803 ext2fs_bg_free_inodes_count_set(fs, i, free_array[i]); in check_inode_bitmaps()
804 ext2fs_mark_super_dirty(fs); in check_inode_bitmaps()
806 ext2fs_unmark_valid(fs); in check_inode_bitmaps()
808 if (dir_array[i] != ext2fs_bg_used_dirs_count(fs, i)) { in check_inode_bitmaps()
810 pctx.ino = ext2fs_bg_used_dirs_count(fs, i); in check_inode_bitmaps()
815 ext2fs_bg_used_dirs_count_set(fs, i, dir_array[i]); in check_inode_bitmaps()
816 ext2fs_mark_super_dirty(fs); in check_inode_bitmaps()
818 ext2fs_unmark_valid(fs); in check_inode_bitmaps()
821 if (free_inodes != fs->super->s_free_inodes_count) { in check_inode_bitmaps()
823 pctx.ino = fs->super->s_free_inodes_count; in check_inode_bitmaps()
827 fs->super->s_free_inodes_count = free_inodes; in check_inode_bitmaps()
828 ext2fs_mark_super_dirty(fs); in check_inode_bitmaps()
838 ext2_filsys fs = ctx->fs; in check_inode_end() local
845 end = (__u64)EXT2_INODES_PER_GROUP(fs->super) * fs->group_desc_count; in check_inode_end()
846 pctx.errcode = ext2fs_fudge_inode_bitmap_end(fs->inode_map, end, in check_inode_end()
859 if (!ext2fs_test_inode_bitmap(fs->inode_map, i)) { in check_inode_end()
863 ext2fs_mark_inode_bitmap(fs->inode_map, in check_inode_end()
865 ext2fs_mark_ib_dirty(fs); in check_inode_end()
867 ext2fs_unmark_valid(fs); in check_inode_end()
872 pctx.errcode = ext2fs_fudge_inode_bitmap_end(fs->inode_map, in check_inode_end()
889 if (!asked && fs->flags & EXT2_FLAG_IBITMAP_TAIL_PROBLEM) { in check_inode_end()
891 ext2fs_mark_ib_dirty(fs); in check_inode_end()
893 ext2fs_unmark_valid(fs); in check_inode_end()
899 ext2_filsys fs = ctx->fs; in check_block_end() local
906 end = ext2fs_get_block_bitmap_start2(fs->block_map) + in check_block_end()
907 EXT2_GROUPS_TO_CLUSTERS(fs->super, fs->group_desc_count) - 1; in check_block_end()
908 pctx.errcode = ext2fs_fudge_block_bitmap_end2(fs->block_map, end, in check_block_end()
921 if (!ext2fs_test_block_bitmap2(fs->block_map, in check_block_end()
922 EXT2FS_C2B(fs, i))) { in check_block_end()
926 ext2fs_mark_block_bitmap2(fs->block_map, in check_block_end()
927 EXT2FS_C2B(fs, i)); in check_block_end()
928 ext2fs_mark_bb_dirty(fs); in check_block_end()
930 ext2fs_unmark_valid(fs); in check_block_end()
935 pctx.errcode = ext2fs_fudge_block_bitmap_end2(fs->block_map, in check_block_end()
952 if (!asked && fs->flags & EXT2_FLAG_BBITMAP_TAIL_PROBLEM) { in check_block_end()
954 ext2fs_mark_bb_dirty(fs); in check_block_end()
956 ext2fs_unmark_valid(fs); in check_block_end()