Lines Matching refs:inode

39 /* The inode block count for a file/directory is in units of 512 byte blocks,
258 static int read_inode(int fd, unsigned int inum, struct ext4_inode *inode)
271 critical_error_errno("failed to seek to inode %d\n", inum);
274 len=read(fd, inode, sizeof(*inode));
275 if (len != sizeof(*inode)) {
276 critical_error_errno("failed to read inode %d\n", inum);
346 * new_inodes_per_group, retrieve the inode bitmap, and make sure
362 printf("Warning: updated inode bitmap for block group %d\n", bg_num);
399 critical_error("Failed sanity check on new inode count\n");
402 critical_error("Failed sanity check on new inode per group alignment\n");
453 static int get_direct_blocks(struct ext4_inode *inode, unsigned long long *block_list,
461 while ((i < (inode->i_blocks_lo / sectors_per_block)) && (i < EXT4_NDIR_BLOCKS)) {
462 block_list[i] = inode->i_block[i];
468 if ((inode->i_blocks_lo / sectors_per_block) > EXT4_NDIR_BLOCKS) {
475 static int get_indirect_blocks(int fd, struct ext4_inode *inode,
489 read_block(fd, inode->i_block[EXT4_NDIR_BLOCKS], indirect_block);
491 for(i = 0; i < (inode->i_blocks_lo / sectors_per_block - EXT4_NDIR_BLOCKS); i++) {
502 static int get_block_list_indirect(int fd, struct ext4_inode *inode, unsigned long long *block_list)
506 if (get_direct_blocks(inode, block_list, &count)) {
507 get_indirect_blocks(fd, inode, block_list, &count);
572 static int get_block_list_extents(int fd, struct ext4_inode *inode, unsigned long long *block_list)
576 extent_hdr = (struct ext4_extent_header *)inode->i_block;
584 get_extent_ents(fd, (struct ext4_extent_header *)inode->i_block, block_list);
588 get_extent_idx(fd, (struct ext4_extent_header *)inode->i_block, block_list);
595 struct ext4_inode inode;
602 * so we have to go fetch it from the inode. Grrr.
604 /* if UPDATE_INODE_NUMS pass and the inode high bit is not
606 * already updated. Otherwise, fetch inode, and return answer.
608 if ((pass == UPDATE_INODE_NUMS) && !(dirp->inode & 0x80000000)) {
611 read_inode(fd, (dirp->inode & 0x7fffffff), &inode);
612 if (S_ISDIR(inode.i_mode)) {
621 static int recurse_dir(int fd, struct ext4_inode *inode, char *dirbuf, int dirsize, int mode)
653 if (inode->i_flags & EXT4_EXTENTS_FL) {
654 get_block_list_extents(fd, inode, block_list);
668 get_block_list_indirect(fd, inode, block_list);
694 if (dirp->inode == 0) {
703 * Otherwise, this inode entry has already been updated
709 * seems to imply I need to read the inode and get it.
714 ((mode == UPDATE_INODE_NUMS) && (dirp->inode & 0x80000000))) ) {
716 read_inode(fd, dirp->inode & 0x7fffffff, &tmp_inode);
719 critical_error("inode %d for name %s does not point to a directory\n",
720 dirp->inode & 0x7fffffff, name);
723 printf("inode %d %s use extents\n", dirp->inode & 0x7fffffff,
750 /* Process entry based on current mode. Either set high bit or change inode number */
752 dirp->inode |= 0x80000000;
754 if (dirp->inode & 0x80000000) {
755 dirp->inode = compute_new_inum(dirp->inode & 0x7fffffff);
834 critical_error("root inode %d does not point to a directory\n", EXT4_ROOT_INO);
837 printf("inode %d %s use extents\n", EXT4_ROOT_INO,
859 * old inodes/group, but some inode numbers may be updated to the new number.