Home | History | Annotate | Download | only in ext4_utils

Lines Matching full:inode

39 /* The inode block count for a file/directory is in units of 512 byte blocks,
242 printf(" Inode size: %d\n", info.inode_size);
257 static int read_inode(int fd, unsigned int inum, struct ext4_inode *inode)
270 critical_error_errno("failed to seek to inode %d\n", inum);
273 len=read(fd, inode, sizeof(*inode));
274 if (len != sizeof(*inode)) {
275 critical_error_errno("failed to read inode %d\n", inum);
345 * new_inodes_per_group, retrieve the inode bitmap, and make sure
361 printf("Warning: updated inode bitmap for block group %d\n", bg_num);
398 critical_error("Failed sanity check on new inode count\n");
401 critical_error("Failed sanity check on new inode per group alignment\n");
452 static int get_direct_blocks(struct ext4_inode *inode, unsigned long long *block_list,
460 while ((i < (inode->i_blocks_lo / sectors_per_block)) && (i < EXT4_NDIR_BLOCKS)) {
461 block_list[i] = inode->i_block[i];
467 if ((inode->i_blocks_lo / sectors_per_block) > EXT4_NDIR_BLOCKS) {
474 static int get_indirect_blocks(int fd, struct ext4_inode *inode,
488 read_block(fd, inode->i_block[EXT4_NDIR_BLOCKS], indirect_block);
490 for(i = 0; i < (inode->i_blocks_lo / sectors_per_block - EXT4_NDIR_BLOCKS); i++) {
501 static int get_block_list_indirect(int fd, struct ext4_inode *inode, unsigned long long *block_list)
505 if (get_direct_blocks(inode, block_list, &count)) {
506 get_indirect_blocks(fd, inode, block_list, &count);
571 static int get_block_list_extents(int fd, struct ext4_inode *inode, unsigned long long *block_list)
575 extent_hdr = (struct ext4_extent_header *)inode->i_block;
583 get_extent_ents((struct ext4_extent_header *)inode->i_block, block_list);
587 get_extent_idx(fd, (struct ext4_extent_header *)inode->i_block, block_list);
594 struct ext4_inode inode;
601 * so we have to go fetch it from the inode. Grrr.
603 /* if UPDATE_INODE_NUMS pass and the inode high bit is not
605 * already updated. Otherwise, fetch inode, and return answer.
607 if ((pass == UPDATE_INODE_NUMS) && !(dirp->inode & 0x80000000)) {
610 read_inode(fd, (dirp->inode & 0x7fffffff), &inode);
611 if (S_ISDIR(inode.i_mode)) {
620 static int recurse_dir(int fd, struct ext4_inode *inode, char *dirbuf, int dirsize, int mode)
652 if (inode->i_flags & EXT4_EXTENTS_FL) {
653 get_block_list_extents(fd, inode, block_list);
667 get_block_list_indirect(fd, inode, block_list);
693 if (dirp->inode == 0) {
702 * Otherwise, this inode entry has already been updated
708 * seems to imply I need to read the inode and get it.
713 ((mode == UPDATE_INODE_NUMS) && (dirp->inode & 0x80000000))) ) {
715 read_inode(fd, dirp->inode & 0x7fffffff, &tmp_inode);
718 critical_error("inode %d for name %s does not point to a directory\n",
719 dirp->inode & 0x7fffffff, name);
722 printf("inode %d %s use extents\n", dirp->inode & 0x7fffffff,
749 /* Process entry based on current mode. Either set high bit or change inode number */
751 dirp->inode |= 0x80000000;
753 if (dirp->inode & 0x80000000) {
754 dirp->inode = compute_new_inum(dirp->inode & 0x7fffffff);
833 critical_error("root inode %d does not point to a directory\n", EXT4_ROOT_INO);
836 printf("inode %d %s use extents\n", EXT4_ROOT_INO,
858 * old inodes/group, but some inode numbers may be updated to the new number.