Lines Matching refs:inode
91 struct ext2_inode *inode; member
99 struct ext2_inode inode; member
135 struct ext2_inode *inode) in e2fsck_pass1_check_device_inode() argument
143 if (inode->i_flags & EXT2_INDEX_FL) in e2fsck_pass1_check_device_inode()
157 if (inode->i_flags & (EXT2_IMMUTABLE_FL | EXT2_APPEND_FL)) { in e2fsck_pass1_check_device_inode()
159 if (inode->i_block[i]) in e2fsck_pass1_check_device_inode()
170 struct ext2_inode *inode, char *buf) in e2fsck_pass1_check_symlink() argument
179 if ((inode->i_size_high || inode->i_size == 0) || in e2fsck_pass1_check_symlink()
180 (inode->i_flags & EXT2_INDEX_FL)) in e2fsck_pass1_check_symlink()
183 if (inode->i_flags & EXT4_EXTENTS_FL) { in e2fsck_pass1_check_symlink()
184 if (inode->i_size > fs->blocksize) in e2fsck_pass1_check_symlink()
186 if (ext2fs_extent_open2(fs, ino, inode, &handle)) in e2fsck_pass1_check_symlink()
205 blocks = ext2fs_inode_data_blocks2(fs, inode); in e2fsck_pass1_check_symlink()
207 if ((inode->i_size >= fs->blocksize) || in e2fsck_pass1_check_symlink()
209 (inode->i_block[0] < fs->super->s_first_data_block) || in e2fsck_pass1_check_symlink()
210 (inode->i_block[0] >= ext2fs_blocks_count(fs->super))) in e2fsck_pass1_check_symlink()
214 if (inode->i_block[i]) in e2fsck_pass1_check_symlink()
217 if (io_channel_read_blk64(fs->io, inode->i_block[0], 1, buf)) in e2fsck_pass1_check_symlink()
220 if (inode->i_flags & EXT4_ENCRYPT_FL) { in e2fsck_pass1_check_symlink()
228 if (inode->i_size >= sizeof(inode->i_block)) in e2fsck_pass1_check_symlink()
231 len = strnlen((char *)inode->i_block, sizeof(inode->i_block)); in e2fsck_pass1_check_symlink()
232 if (len == sizeof(inode->i_block)) in e2fsck_pass1_check_symlink()
235 if (len != inode->i_size) in e2fsck_pass1_check_symlink()
236 if ((inode->i_flags & EXT4_ENCRYPT_FL) == 0) in e2fsck_pass1_check_symlink()
248 if (!(pctx->inode->i_flags & BAD_SPECIAL_FLAGS)) in check_immutable()
254 pctx->inode->i_flags &= ~BAD_SPECIAL_FLAGS; in check_immutable()
255 e2fsck_write_inode(ctx, pctx->ino, pctx->inode, "pass1"); in check_immutable()
264 struct ext2_inode *inode = pctx->inode; in check_size() local
266 if (EXT2_I_SIZE(inode) == 0) in check_size()
272 inode->i_size = 0; in check_size()
273 inode->i_size_high = 0; in check_size()
274 e2fsck_write_inode(ctx, pctx->ino, pctx->inode, "pass1"); in check_size()
280 struct ext2_inode_large *inode; in check_ea_in_inode() local
286 inode = (struct ext2_inode_large *) pctx->inode; in check_ea_in_inode()
288 inode->i_extra_isize; in check_ea_in_inode()
289 start = ((char *) inode) + EXT2_GOOD_OLD_INODE_SIZE + in check_ea_in_inode()
290 inode->i_extra_isize + sizeof(__u32); in check_ea_in_inode()
352 e2fsck_write_inode_full(ctx, pctx->ino, pctx->inode, in check_ea_in_inode()
359 struct ext2_inode_large *inode; in check_inode_extra_space() local
363 inode = (struct ext2_inode_large *) pctx->inode; in check_inode_extra_space()
371 inode->i_extra_isize); in check_inode_extra_space()
374 min = sizeof(inode->i_extra_isize) + sizeof(inode->i_checksum_hi); in check_inode_extra_space()
380 if (inode->i_extra_isize && in check_inode_extra_space()
381 (inode->i_extra_isize < min || inode->i_extra_isize > max)) { in check_inode_extra_space()
384 inode->i_extra_isize = min; in check_inode_extra_space()
385 e2fsck_write_inode_full(ctx, pctx->ino, pctx->inode, in check_inode_extra_space()
390 eamagic = (__u32 *) (((char *) inode) + EXT2_GOOD_OLD_INODE_SIZE + in check_inode_extra_space()
391 inode->i_extra_isize); in check_inode_extra_space()
409 struct ext2_inode *inode = pctx->inode; in check_is_really_dir() local
423 if (LINUX_S_ISDIR(inode->i_mode) || LINUX_S_ISREG(inode->i_mode) || in check_is_really_dir()
424 LINUX_S_ISLNK(inode->i_mode) || inode->i_block[0] == 0) in check_is_really_dir()
446 if (extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) { in check_is_really_dir()
448 if (ext2fs_bmap2(ctx->fs, pctx->ino, inode, 0, 0, 0, 0, in check_is_really_dir()
455 blk = inode->i_block[i]; in check_is_really_dir()
467 blk = inode->i_block[0]; in check_is_really_dir()
475 if ((LINUX_S_ISCHR(inode->i_mode) || LINUX_S_ISBLK(inode->i_mode)) && in check_is_really_dir()
476 (inode->i_links_count == 1) && !not_device) in check_is_really_dir()
492 (dirent->inode != pctx->ino) || in check_is_really_dir()
510 inode->i_mode = (inode->i_mode & 07777) | LINUX_S_IFDIR; in check_is_really_dir()
511 e2fsck_write_inode_full(ctx, pctx->ino, inode, in check_is_really_dir()
554 struct ext2_inode *inode; in e2fsck_pass1() local
656 inode = (struct ext2_inode *) in e2fsck_pass1()
670 ext2fs_free_mem(&inode); in e2fsck_pass1()
694 ext2fs_free_mem(&inode); in e2fsck_pass1()
708 ext2fs_free_mem(&inode); in e2fsck_pass1()
712 ctx->stashed_inode = inode; in e2fsck_pass1()
736 inode, inode_size); in e2fsck_pass1()
755 pctx.inode = inode; in e2fsck_pass1()
757 if (inode->i_links_count) { in e2fsck_pass1()
759 ino, inode->i_links_count); in e2fsck_pass1()
761 pctx.num = inode->i_links_count; in e2fsck_pass1()
783 if ((inode->i_flags & EXT4_EXTENTS_FL) && !extent_fs && in e2fsck_pass1()
784 (inode->i_links_count || (ino == EXT2_BAD_INO) || in e2fsck_pass1()
786 if ((ext2fs_extent_header_verify(inode->i_block, in e2fsck_pass1()
787 sizeof(inode->i_block)) == 0) && in e2fsck_pass1()
794 e2fsck_clear_inode(ctx, ino, inode, 0, "pass1"); in e2fsck_pass1()
810 if (extent_fs && !(inode->i_flags & EXT4_EXTENTS_FL) && in e2fsck_pass1()
811 (inode->i_links_count || (ino == EXT2_BAD_INO) || in e2fsck_pass1()
813 (LINUX_S_ISREG(inode->i_mode) || in e2fsck_pass1()
814 LINUX_S_ISDIR(inode->i_mode))) { in e2fsck_pass1()
820 tmp_block[i] = ext2fs_swab32(inode->i_block[i]); in e2fsck_pass1()
823 ehp = inode->i_block; in e2fsck_pass1()
826 sizeof(inode->i_block)) == 0) && in e2fsck_pass1()
828 inode->i_flags |= EXT4_EXTENTS_FL; in e2fsck_pass1()
830 memcpy(inode->i_block, tmp_block, in e2fsck_pass1()
831 sizeof(inode->i_block)); in e2fsck_pass1()
833 e2fsck_write_inode(ctx, ino, inode, "pass1"); in e2fsck_pass1()
840 if ((inode->i_mode || inode->i_uid || inode->i_gid || in e2fsck_pass1()
841 inode->i_links_count || inode->i_file_acl) && in e2fsck_pass1()
843 memset(inode, 0, sizeof(struct ext2_inode)); in e2fsck_pass1()
844 e2fsck_write_inode(ctx, ino, inode, in e2fsck_pass1()
862 pb.inode = inode; in e2fsck_pass1()
887 if (!LINUX_S_ISDIR(inode->i_mode)) { in e2fsck_pass1()
900 if (inode->i_dtime && inode->i_links_count) { in e2fsck_pass1()
902 inode->i_dtime = 0; in e2fsck_pass1()
903 e2fsck_write_inode(ctx, ino, inode, in e2fsck_pass1()
910 if (!LINUX_S_ISREG(inode->i_mode) && in e2fsck_pass1()
913 inode->i_mode = LINUX_S_IFREG; in e2fsck_pass1()
914 e2fsck_write_inode(ctx, ino, inode, in e2fsck_pass1()
920 if ((inode->i_links_count || in e2fsck_pass1()
921 inode->i_blocks || inode->i_block[0]) && in e2fsck_pass1()
924 memset(inode, 0, inode_size); in e2fsck_pass1()
927 e2fsck_write_inode_full(ctx, ino, inode, in e2fsck_pass1()
937 if (!LINUX_S_ISREG(inode->i_mode) && in e2fsck_pass1()
940 inode->i_mode = LINUX_S_IFREG; in e2fsck_pass1()
941 e2fsck_write_inode(ctx, ino, inode, in e2fsck_pass1()
947 if ((inode->i_links_count || in e2fsck_pass1()
948 inode->i_blocks || inode->i_block[0]) && in e2fsck_pass1()
951 memset(inode, 0, inode_size); in e2fsck_pass1()
954 e2fsck_write_inode_full(ctx, ino, inode, in e2fsck_pass1()
962 if (LINUX_S_ISDIR(inode->i_mode)) in e2fsck_pass1()
965 if (inode->i_mode && in e2fsck_pass1()
966 !LINUX_S_ISREG(inode->i_mode)) in e2fsck_pass1()
969 if (inode->i_mode != 0) in e2fsck_pass1()
974 inode->i_mode = 0; in e2fsck_pass1()
975 e2fsck_write_inode(ctx, ino, inode, in e2fsck_pass1()
1000 if (inode->i_dtime && !busted_fs_time && in e2fsck_pass1()
1001 inode->i_dtime < ctx->fs->super->s_inodes_count) { in e2fsck_pass1()
1003 inode->i_dtime = inode->i_links_count ? in e2fsck_pass1()
1005 e2fsck_write_inode(ctx, ino, inode, in e2fsck_pass1()
1014 if (!inode->i_links_count) { in e2fsck_pass1()
1015 if (!inode->i_dtime && inode->i_mode) { in e2fsck_pass1()
1018 inode->i_dtime = ctx->now; in e2fsck_pass1()
1019 e2fsck_write_inode(ctx, ino, inode, in e2fsck_pass1()
1035 if (inode->i_dtime) { in e2fsck_pass1()
1037 inode->i_dtime = 0; in e2fsck_pass1()
1038 e2fsck_write_inode(ctx, ino, inode, "pass1"); in e2fsck_pass1()
1045 frag = inode->osd2.hurd2.h_i_frag; in e2fsck_pass1()
1046 fsize = inode->osd2.hurd2.h_i_fsize; in e2fsck_pass1()
1052 if (inode->i_faddr || frag || fsize || in e2fsck_pass1()
1053 (LINUX_S_ISDIR(inode->i_mode) && inode->i_dir_acl)) in e2fsck_pass1()
1057 inode->osd2.linux2.l_i_file_acl_high != 0) in e2fsck_pass1()
1062 (inode->osd2.linux2.l_i_blocks_hi != 0)) in e2fsck_pass1()
1064 if (inode->i_flags & EXT2_IMAGIC_FL) { in e2fsck_pass1()
1072 inode->i_flags &= ~EXT2_IMAGIC_FL; in e2fsck_pass1()
1074 inode, "pass1"); in e2fsck_pass1()
1086 if (extent_fs && (inode->i_flags & EXT4_EXTENTS_FL) && in e2fsck_pass1()
1087 LINUX_S_ISLNK(inode->i_mode) && in e2fsck_pass1()
1088 !ext2fs_inode_has_valid_blocks2(fs, inode) && in e2fsck_pass1()
1090 inode->i_flags &= ~EXT4_EXTENTS_FL; in e2fsck_pass1()
1091 e2fsck_write_inode(ctx, ino, inode, "pass1"); in e2fsck_pass1()
1094 if (LINUX_S_ISDIR(inode->i_mode)) { in e2fsck_pass1()
1098 if (inode->i_flags & EXT4_ENCRYPT_FL) in e2fsck_pass1()
1100 } else if (LINUX_S_ISREG (inode->i_mode)) { in e2fsck_pass1()
1103 } else if (LINUX_S_ISCHR (inode->i_mode) && in e2fsck_pass1()
1104 e2fsck_pass1_check_device_inode(fs, inode)) { in e2fsck_pass1()
1108 } else if (LINUX_S_ISBLK (inode->i_mode) && in e2fsck_pass1()
1109 e2fsck_pass1_check_device_inode(fs, inode)) { in e2fsck_pass1()
1113 } else if (LINUX_S_ISLNK (inode->i_mode) && in e2fsck_pass1()
1114 e2fsck_pass1_check_symlink(fs, ino, inode, in e2fsck_pass1()
1118 if (ext2fs_inode_data_blocks(fs, inode) == 0) { in e2fsck_pass1()
1124 else if (LINUX_S_ISFIFO (inode->i_mode) && in e2fsck_pass1()
1125 e2fsck_pass1_check_device_inode(fs, inode)) { in e2fsck_pass1()
1129 } else if ((LINUX_S_ISSOCK (inode->i_mode)) && in e2fsck_pass1()
1130 e2fsck_pass1_check_device_inode(fs, inode)) { in e2fsck_pass1()
1136 if (!(inode->i_flags & EXT4_EXTENTS_FL)) { in e2fsck_pass1()
1137 if (inode->i_block[EXT2_IND_BLOCK]) in e2fsck_pass1()
1139 if (inode->i_block[EXT2_DIND_BLOCK]) in e2fsck_pass1()
1141 if (inode->i_block[EXT2_TIND_BLOCK]) in e2fsck_pass1()
1144 if (!(inode->i_flags & EXT4_EXTENTS_FL) && in e2fsck_pass1()
1145 (inode->i_block[EXT2_IND_BLOCK] || in e2fsck_pass1()
1146 inode->i_block[EXT2_DIND_BLOCK] || in e2fsck_pass1()
1147 inode->i_block[EXT2_TIND_BLOCK] || in e2fsck_pass1()
1148 ext2fs_file_acl_block(fs, inode))) { in e2fsck_pass1()
1150 inodes_to_process[process_inode_count].inode = *inode; in e2fsck_pass1()
1210 e2fsck_read_inode(ctx, EXT2_RESIZE_INO, inode, in e2fsck_pass1()
1212 inode->i_mtime = ctx->now; in e2fsck_pass1()
1213 e2fsck_write_inode(ctx, EXT2_RESIZE_INO, inode, in e2fsck_pass1()
1244 ext2fs_free_mem(&inode); in e2fsck_pass1()
1297 pctx.inode = ctx->stashed_inode = &inodes_to_process[i].inode; in process_inodes()
1327 ret = (ib_a->inode.i_block[EXT2_IND_BLOCK] - in process_inode_cmp()
1328 ib_b->inode.i_block[EXT2_IND_BLOCK]); in process_inode_cmp()
1335 ret = ext2fs_file_acl_block(0, &(ib_a->inode)) - in process_inode_cmp()
1336 ext2fs_file_acl_block(0, &(ib_b->inode)); in process_inode_cmp()
1522 struct ext2_inode *inode = pctx->inode; in check_ext_attr() local
1530 blk = ext2fs_file_acl_block(fs, inode); in check_ext_attr()
1606 pctx->blk = ext2fs_file_acl_block(fs, inode); in check_ext_attr()
1694 ext2fs_file_acl_block_set(fs, inode, 0); in check_ext_attr()
1695 e2fsck_write_inode(ctx, ino, inode, "check_ext_attr"); in check_ext_attr()
1701 ext2_ino_t ino, struct ext2_inode *inode, in handle_htree() argument
1709 if ((!LINUX_S_ISDIR(inode->i_mode) && in handle_htree()
1715 pctx->errcode = ext2fs_bmap2(fs, ino, inode, 0, 0, 0, 0, &blk); in handle_htree()
1758 struct ext2_inode *inode, int restart_flag, in e2fsck_clear_inode() argument
1761 inode->i_flags = 0; in e2fsck_clear_inode()
1762 inode->i_links_count = 0; in e2fsck_clear_inode()
1764 inode->i_dtime = ctx->now; in e2fsck_clear_inode()
1780 memset(inode, 0, sizeof(struct ext2_inode)); in e2fsck_clear_inode()
1782 e2fsck_write_inode(ctx, ino, inode, source); in e2fsck_clear_inode()
1807 is_dir = LINUX_S_ISDIR(pctx->inode->i_mode); in scan_extent_node()
1983 struct ext2_inode *inode = pctx->inode; in check_blocks_extents() local
1990 pctx->errcode = ext2fs_extent_open2(fs, ino, inode, &ehandle); in check_blocks_extents()
1993 e2fsck_clear_inode(ctx, ino, inode, 0, in check_blocks_extents()
2006 eof_lblk = ((EXT2_I_SIZE(inode) + fs->blocksize - 1) >> in check_blocks_extents()
2012 inode->i_blocks = 0; in check_blocks_extents()
2013 e2fsck_clear_inode(ctx, ino, inode, E2F_FLAG_RESTART, in check_blocks_extents()
2030 struct ext2_inode *inode = pctx->inode; in check_blocks() local
2046 pb.is_dir = LINUX_S_ISDIR(inode->i_mode); in check_blocks()
2047 pb.is_reg = LINUX_S_ISREG(inode->i_mode); in check_blocks()
2049 pb.inode = inode; in check_blocks()
2058 if (inode->i_flags & EXT2_COMPRBLK_FL) { in check_blocks()
2064 inode->i_flags &= ~EXT2_COMPRBLK_FL; in check_blocks()
2070 if (ext2fs_file_acl_block(fs, inode) && in check_blocks()
2077 if (ext2fs_inode_has_valid_blocks2(fs, inode)) { in check_blocks()
2078 if (extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) in check_blocks()
2099 if (LINUX_S_ISDIR(inode->i_mode)) in check_blocks()
2106 e2fsck_clear_inode(ctx, ino, inode, E2F_FLAG_RESTART, in check_blocks()
2111 if (inode->i_flags & EXT2_INDEX_FL) { in check_blocks()
2112 if (handle_htree(ctx, pctx, ino, inode, block_buf)) { in check_blocks()
2113 inode->i_flags &= ~EXT2_INDEX_FL; in check_blocks()
2124 e2fsck_clear_inode(ctx, ino, inode, 0, "check_blocks"); in check_blocks()
2131 quota_data_add(ctx->qctx, inode, ino, in check_blocks()
2133 quota_data_inodes(ctx->qctx, inode, ino, +1); in check_blocks()
2138 !(inode->i_flags & EXT4_HUGE_FILE_FL)) in check_blocks()
2143 ino, inode->i_size, pb.last_block, ext2fs_inode_i_blocks(fs, inode), in check_blocks()
2147 int nblock = inode->i_size >> EXT2_BLOCK_SIZE_BITS(fs->super); in check_blocks()
2148 if (inode->i_size & (fs->blocksize - 1)) in check_blocks()
2160 size = EXT2_I_SIZE(inode); in check_blocks()
2168 else if (!(extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) && in check_blocks()
2172 else if ((extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) && in check_blocks()
2179 if (bad_size && !LINUX_S_ISLNK(inode->i_mode)) { in check_blocks()
2183 inode->i_size = pctx->num; in check_blocks()
2184 if (!LINUX_S_ISDIR(inode->i_mode)) in check_blocks()
2185 inode->i_size_high = pctx->num >> 32; in check_blocks()
2190 if (LINUX_S_ISREG(inode->i_mode) && in check_blocks()
2191 ext2fs_needs_large_file_feature(EXT2_I_SIZE(inode))) in check_blocks()
2193 if ((pb.num_blocks != ext2fs_inode_i_blocks(fs, inode)) || in check_blocks()
2196 (inode->i_flags & EXT4_HUGE_FILE_FL) && in check_blocks()
2197 (inode->osd2.linux2.l_i_blocks_hi != 0))) { in check_blocks()
2200 inode->i_blocks = pb.num_blocks; in check_blocks()
2201 inode->osd2.linux2.l_i_blocks_hi = pb.num_blocks >> 32; in check_blocks()
2208 !(inode->i_flags & EXT2_INDEX_FL) && in check_blocks()
2209 ((inode->i_size / fs->blocksize) >= 3)) in check_blocks()
2214 e2fsck_write_inode(ctx, ino, inode, "check_blocks"); in check_blocks()
2573 if ((blk == p->inode->i_block[EXT2_IND_BLOCK]) || in process_bad_block()
2574 (blk == p->inode->i_block[EXT2_DIND_BLOCK]) || in process_bad_block()
2575 (blk == p->inode->i_block[EXT2_TIND_BLOCK])) { in process_bad_block()
2819 struct ext2_inode *inode) in pass1_read_inode() argument
2825 *inode = *ctx->stashed_inode; in pass1_read_inode()
2830 struct ext2_inode *inode) in pass1_write_inode() argument
2835 (inode != ctx->stashed_inode)) in pass1_write_inode()
2836 *ctx->stashed_inode = *inode; in pass1_write_inode()