• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-12-stable/sys/fs/ext2fs/

Lines Matching refs:ip

70 static void ext4_ext_print_header(struct inode *ip, struct ext4_extent_header *ehp);
73 ext4_ext_print_index(struct inode *ip, struct ext4_extent_index *ex, int do_walk)
79 fs = ip->i_e2fs;
87 if ((error = bread(ip->i_devvp,
94 ext4_ext_print_header(ip, (struct ext4_extent_header *)bp->b_data);
101 ext4_ext_print_header(struct inode *ip, struct ext4_extent_header *ehp)
111 ext4_ext_print_index(ip,
118 ext4_ext_print_path(struct inode *ip, struct ext4_extent_path *path)
124 printf("ip=%ju, Path:\n", ip->i_number);
127 ext4_ext_print_index(ip, path->ep_index, 0);
135 ext4_ext_print_extent_tree_status(struct inode *ip)
139 ehp = (struct ext4_extent_header *)(char *)ip->i_db;
141 printf("Extent status:ip=%ju\n", ip->i_number);
142 if (!(ip->i_flag & IN_E4EXTENTS))
145 ext4_ext_print_header(ip, ehp);
152 ext4_ext_inode_header(struct inode *ip)
155 return ((struct ext4_extent_header *)ip->i_db);
166 ext4_ext_inode_depth(struct inode *ip)
170 ehp = (struct ext4_extent_header *)ip->i_data;
214 ext4_ext_in_cache(struct inode *ip, daddr_t lbn, struct ext4_extent *ep)
219 ecp = &ip->i_ext_cache;
234 ext4_ext_check_header(struct inode *ip, struct ext4_extent_header *eh)
239 fs = ip->i_e2fs;
366 ext4_ext_find_extent(struct inode *ip, daddr_t block,
376 fs = ip->i_e2fs;
377 eh = ext4_ext_inode_header(ip);
378 depth = ext4_ext_inode_depth(ip);
382 error = ext4_ext_check_header(ip, eh);
409 error = bread(ip->i_devvp, fsbtodb(ip->i_e2fs, blk),
410 ip->i_e2fs->e2fs_bsize, NOCRED, &bp);
429 if (ext4_ext_check_header(ip, eh) ||
430 ext2_extent_blk_csum_verify(ip, path[ppos].ep_data)) {
440 error = ext4_ext_check_header(ip, eh);
463 ext4_ext_space_root(struct inode *ip)
467 size = sizeof(ip->i_data);
475 ext4_ext_space_block(struct inode *ip)
480 fs = ip->i_e2fs;
489 ext4_ext_space_block_index(struct inode *ip)
494 fs = ip->i_e2fs;
503 ext4_ext_tree_init(struct inode *ip)
507 ip->i_flag |= IN_E4EXTENTS;
509 memset(ip->i_data, 0, EXT2_NDADDR + EXT2_NIADDR);
510 ehp = (struct ext4_extent_header *)ip->i_data;
512 ehp->eh_max = ext4_ext_space_root(ip);
513 ip->i_ext_cache.ec_type = EXT4_EXT_CACHE_NO;
514 ip->i_flag |= IN_CHANGE | IN_UPDATE;
515 ext2_update(ip->i_vnode, 1);
519 ext4_ext_put_in_cache(struct inode *ip, uint32_t blk,
525 ip->i_ext_cache.ec_type = type;
526 ip->i_ext_cache.ec_blk = blk;
527 ip->i_ext_cache.ec_len = len;
528 ip->i_ext_cache.ec_start = start;
532 ext4_ext_blkpref(struct inode *ip, struct ext4_extent_path *path,
540 fs = ip->i_e2fs;
561 bg_start = (ip->i_block_group * EXT2_BLOCKS_PER_GROUP(ip->i_e2fs)) +
586 ext4_ext_next_leaf_block(struct inode *ip, struct ext4_extent_path *path)
609 ext4_ext_dirty(struct inode *ip, struct ext4_extent_path *path)
616 fs = ip->i_e2fs;
623 bp = getblk(ip->i_devvp, fsbtodb(fs, blk),
628 ext2_extent_blk_csum_set(ip, bp->b_data);
631 ip->i_flag |= IN_CHANGE | IN_UPDATE;
632 error = ext2_update(ip->i_vnode, 1);
639 ext4_ext_insert_index(struct inode *ip, struct ext4_extent_path *path,
646 fs = ip->i_e2fs;
682 return (ext4_ext_dirty(ip, path));
686 ext4_ext_alloc_meta(struct inode *ip)
688 e4fs_daddr_t blk = ext2_alloc_meta(ip);
690 ip->i_blocks += btodb(ip->i_e2fs->e2fs_bsize);
691 ip->i_flag |= IN_CHANGE | IN_UPDATE;
692 ext2_update(ip->i_vnode, 1);
699 ext4_ext_blkfree(struct inode *ip, uint64_t blk, int count, int flags)
704 fs = ip->i_e2fs;
708 ext2_blkfree(ip, blk + i, fs->e2fs_bsize);
710 if (ip->i_blocks >= blocksreleased)
711 ip->i_blocks -= (btodb(fs->e2fs_bsize)*blocksreleased);
713 ip->i_blocks = 0;
715 ip->i_flag |= IN_CHANGE | IN_UPDATE;
716 ext2_update(ip->i_vnode, 1);
720 ext4_ext_split(struct inode *ip, struct ext4_extent_path *path,
725 int depth = ext4_ext_inode_depth(ip);
735 fs = ip->i_e2fs;
756 newblk = ext4_ext_alloc_meta(ip);
763 bp = getblk(ip->i_devvp, fsbtodb(fs, newblk), fs->e2fs_bsize, 0, 0, 0);
771 neh->eh_max = ext4_ext_space_block(ip);
796 ext2_extent_blk_csum_set(ip, bp->b_data);
804 ext4_ext_dirty(ip, path + depth);
816 error = bread(ip->i_devvp, fsbtodb(fs, newblk),
826 neh->eh_max = ext4_ext_space_block_index(ip);
844 ext2_extent_blk_csum_set(ip, bp->b_data);
852 ext4_ext_dirty(ip, path + i);
858 error = ext4_ext_insert_index(ip, path + at, border, newblk);
868 ext4_ext_blkfree(ip, ablks[i], 1, 0);
878 ext4_ext_grow_indepth(struct inode *ip, struct ext4_extent_path *path,
888 fs = ip->i_e2fs;
891 newblk = ext4_ext_alloc_meta(ip);
895 bp = getblk(ip->i_devvp, fsbtodb(fs, newblk), fs->e2fs_bsize, 0, 0, 0);
900 memmove(bp->b_data, curpath->ep_header, sizeof(ip->i_data));
906 if (ext4_ext_inode_depth(ip))
907 neh->eh_max = ext4_ext_space_block_index(ip);
909 neh->eh_max = ext4_ext_space_block(ip);
911 ext2_extent_blk_csum_set(ip, bp->b_data);
919 curpath->ep_header->eh_max = ext4_ext_space_root(ip);
925 neh = ext4_ext_inode_header(ip);
927 ext4_ext_dirty(ip, curpath);
935 ext4_ext_create_new_leaf(struct inode *ip, struct ext4_extent_path *path,
942 i = depth = ext4_ext_inode_depth(ip);
956 error = ext4_ext_split(ip, path, newext, i);
962 error = ext4_ext_find_extent(ip, newext->e_blk, &path);
967 error = ext4_ext_grow_indepth(ip, path, newext);
973 error = ext4_ext_find_extent(ip, newext->e_blk, &path);
978 depth = ext4_ext_inode_depth(ip);
989 ext4_ext_correct_indexes(struct inode *ip, struct ext4_extent_path *path)
996 depth = ext4_ext_inode_depth(ip);
1013 ext4_ext_dirty(ip, path + k);
1020 ext4_ext_dirty(ip, path + k);
1027 ext4_ext_insert_extent(struct inode *ip, struct ext4_extent_path *path,
1035 depth = ext4_ext_inode_depth(ip);
1051 depth = ext4_ext_inode_depth(ip);
1058 next = ext4_ext_next_leaf_block(ip, path);
1063 error = ext4_ext_find_extent(ip, next, &npath);
1083 error = ext4_ext_create_new_leaf(ip, path, newext);
1087 depth = ext4_ext_inode_depth(ip);
1140 error = ext4_ext_correct_indexes(ip, path);
1144 ext4_ext_dirty(ip, path + depth);
1152 ip->i_ext_cache.ec_type = EXT4_EXT_CACHE_NO;
1157 ext4_new_blocks(struct inode *ip, daddr_t lbn, e4fs_daddr_t pref,
1169 fs = ip->i_e2fs;
1170 EXT2_LOCK(ip->i_ump);
1171 *perror = ext2_alloc(ip, lbn, pref, (int)fs->e2fs_bsize, cred, &newblk);
1176 ip->i_flag |= IN_CHANGE | IN_UPDATE;
1177 ext2_update(ip->i_vnode, 1);
1184 ext4_ext_get_blocks(struct inode *ip, e4fs_daddr_t iblk,
1202 if ((bpref = ext4_ext_in_cache(ip, iblk, &newex))) {
1215 error = ext4_ext_find_extent(ip, iblk, &path);
1220 depth = ext4_ext_inode_depth(ip);
1238 ext4_ext_put_in_cache(ip, lblk, e_len,
1245 if (S_ISREG(ip->i_mode) && (!ip->i_next_alloc_block)) {
1246 ip->i_next_alloc_goal = 0;
1249 bpref = ext4_ext_blkpref(ip, path, iblk);
1251 newblk = ext4_new_blocks(ip, iblk, bpref, cred, &allocated, &error);
1259 error = ext4_ext_insert_extent(ip, path, &newex);
1264 ext4_ext_put_in_cache(ip, iblk, allocated, newblk, EXT4_EXT_CACHE_IN);
1273 fs = ip->i_e2fs;
1274 error = bread(ip->i_devvp, fsbtodb(fs, newblk),
1304 ext4_ext_header(struct inode *ip)
1307 return ((struct ext4_extent_header *)ip->i_db);
1311 ext4_remove_blocks(struct inode *ip, struct ext4_extent *ex,
1322 ext4_ext_blkfree(ip, start, num, 0);
1329 ext4_ext_rm_index(struct inode *ip, struct ext4_extent_path *path)
1339 ext4_ext_dirty(ip, path);
1340 ext4_ext_blkfree(ip, leaf, 1, 0);
1345 ext4_ext_rm_leaf(struct inode *ip, struct ext4_extent_path *path,
1356 depth = ext4_ext_inode_depth(ip);
1401 error = ext4_remove_blocks(ip, ex, a, b);
1413 ext4_ext_dirty(ip, path + depth);
1421 error = ext4_ext_correct_indexes(ip, path);
1428 error = ext4_ext_rm_index(ip, path + depth);
1435 ext4_read_extent_tree_block(struct inode *ip, e4fs_daddr_t pblk,
1443 fs = ip->i_e2fs;
1444 error = bread(ip->i_devvp, fsbtodb(fs, pblk),
1458 error = ext4_ext_check_header(ip, eh);
1487 ext4_ext_remove_space(struct inode *ip, off_t length, int flags,
1496 ehp = (struct ext4_extent_header *)ip->i_db;
1497 depth = ext4_ext_inode_depth(ip);
1499 error = ext4_ext_check_header(ip, ehp);
1511 error = ext4_ext_rm_leaf(ip, path, length);
1536 bp = ext4_read_extent_tree_block(ip,
1552 error = ext4_ext_rm_index(ip, path + i);
1564 ext4_ext_header(ip)->eh_depth = 0;
1565 ext4_ext_header(ip)->eh_max = ext4_ext_space_root(ip);
1566 ext4_ext_dirty(ip, path);