• Home
  • Raw
  • Download

Lines Matching refs:path

137 				struct ext4_ext_path *path)  in ext4_ext_get_access()  argument
141 if (path->p_bh) { in ext4_ext_get_access()
143 BUFFER_TRACE(path->p_bh, "get_write_access"); in ext4_ext_get_access()
144 err = ext4_journal_get_write_access(handle, path->p_bh); in ext4_ext_get_access()
152 clear_buffer_verified(path->p_bh); in ext4_ext_get_access()
167 struct ext4_ext_path *path) in __ext4_ext_dirty() argument
172 if (path->p_bh) { in __ext4_ext_dirty()
173 ext4_extent_block_csum_set(inode, ext_block_hdr(path->p_bh)); in __ext4_ext_dirty()
176 inode, path->p_bh); in __ext4_ext_dirty()
179 set_buffer_verified(path->p_bh); in __ext4_ext_dirty()
187 #define ext4_ext_dirty(handle, inode, path) \ argument
188 __ext4_ext_dirty(__func__, __LINE__, (handle), (inode), (path))
191 struct ext4_ext_path *path, in ext4_ext_find_goal() argument
194 if (path) { in ext4_ext_find_goal()
195 int depth = path->p_depth; in ext4_ext_find_goal()
215 ex = path[depth].p_ext; in ext4_ext_find_goal()
228 if (path[depth].p_bh) in ext4_ext_find_goal()
229 return path[depth].p_bh->b_blocknr; in ext4_ext_find_goal()
241 struct ext4_ext_path *path, in ext4_ext_new_meta_block() argument
246 goal = ext4_ext_find_goal(inode, path, le32_to_cpu(ex->ee_block)); in ext4_ext_new_meta_block()
311 struct ext4_ext_path *path = *ppath; in ext4_force_split_extent_at() local
312 int unwritten = ext4_ext_is_unwritten(path[path->p_depth].p_ext); in ext4_force_split_extent_at()
594 struct ext4_ext_path *path = NULL; in ext4_ext_precache() local
610 path = kcalloc(depth + 1, sizeof(struct ext4_ext_path), in ext4_ext_precache()
612 if (path == NULL) { in ext4_ext_precache()
617 path[0].p_hdr = ext_inode_hdr(inode); in ext4_ext_precache()
618 ret = ext4_ext_check(inode, path[0].p_hdr, depth, 0); in ext4_ext_precache()
621 path[0].p_idx = EXT_FIRST_INDEX(path[0].p_hdr); in ext4_ext_precache()
628 path[i].p_idx > EXT_LAST_INDEX(path[i].p_hdr)) { in ext4_ext_precache()
629 brelse(path[i].p_bh); in ext4_ext_precache()
630 path[i].p_bh = NULL; in ext4_ext_precache()
634 bh = read_extent_tree_block(inode, path[i].p_idx++, in ext4_ext_precache()
642 path[i].p_bh = bh; in ext4_ext_precache()
643 path[i].p_hdr = ext_block_hdr(bh); in ext4_ext_precache()
644 path[i].p_idx = EXT_FIRST_INDEX(path[i].p_hdr); in ext4_ext_precache()
649 ext4_ext_drop_refs(path); in ext4_ext_precache()
650 kfree(path); in ext4_ext_precache()
655 static void ext4_ext_show_path(struct inode *inode, struct ext4_ext_path *path) in ext4_ext_show_path() argument
657 int k, l = path->p_depth; in ext4_ext_show_path()
660 for (k = 0; k <= l; k++, path++) { in ext4_ext_show_path()
661 if (path->p_idx) { in ext4_ext_show_path()
663 le32_to_cpu(path->p_idx->ei_block), in ext4_ext_show_path()
664 ext4_idx_pblock(path->p_idx)); in ext4_ext_show_path()
665 } else if (path->p_ext) { in ext4_ext_show_path()
667 le32_to_cpu(path->p_ext->ee_block), in ext4_ext_show_path()
668 ext4_ext_is_unwritten(path->p_ext), in ext4_ext_show_path()
669 ext4_ext_get_actual_len(path->p_ext), in ext4_ext_show_path()
670 ext4_ext_pblock(path->p_ext)); in ext4_ext_show_path()
677 static void ext4_ext_show_leaf(struct inode *inode, struct ext4_ext_path *path) in ext4_ext_show_leaf() argument
684 if (!path) in ext4_ext_show_leaf()
687 eh = path[depth].p_hdr; in ext4_ext_show_leaf()
700 static void ext4_ext_show_move(struct inode *inode, struct ext4_ext_path *path, in ext4_ext_show_move() argument
708 idx = path[level].p_idx; in ext4_ext_show_move()
709 while (idx <= EXT_MAX_INDEX(path[level].p_hdr)) { in ext4_ext_show_move()
719 ex = path[depth].p_ext; in ext4_ext_show_move()
720 while (ex <= EXT_MAX_EXTENT(path[depth].p_hdr)) { in ext4_ext_show_move()
732 #define ext4_ext_show_path(inode, path) argument
733 #define ext4_ext_show_leaf(inode, path) argument
734 #define ext4_ext_show_move(inode, path, newblock, level) argument
737 void ext4_ext_drop_refs(struct ext4_ext_path *path) in ext4_ext_drop_refs() argument
741 if (!path) in ext4_ext_drop_refs()
743 depth = path->p_depth; in ext4_ext_drop_refs()
744 for (i = 0; i <= depth; i++, path++) { in ext4_ext_drop_refs()
745 brelse(path->p_bh); in ext4_ext_drop_refs()
746 path->p_bh = NULL; in ext4_ext_drop_refs()
757 struct ext4_ext_path *path, ext4_lblk_t block) in ext4_ext_binsearch_idx() argument
759 struct ext4_extent_header *eh = path->p_hdr; in ext4_ext_binsearch_idx()
778 path->p_idx = l - 1; in ext4_ext_binsearch_idx()
779 ext_debug(inode, " -> %u->%lld ", le32_to_cpu(path->p_idx->ei_block), in ext4_ext_binsearch_idx()
780 ext4_idx_pblock(path->p_idx)); in ext4_ext_binsearch_idx()
804 BUG_ON(chix != path->p_idx); in ext4_ext_binsearch_idx()
817 struct ext4_ext_path *path, ext4_lblk_t block) in ext4_ext_binsearch() argument
819 struct ext4_extent_header *eh = path->p_hdr; in ext4_ext_binsearch()
846 path->p_ext = l - 1; in ext4_ext_binsearch()
848 le32_to_cpu(path->p_ext->ee_block), in ext4_ext_binsearch()
849 ext4_ext_pblock(path->p_ext), in ext4_ext_binsearch()
850 ext4_ext_is_unwritten(path->p_ext), in ext4_ext_binsearch()
851 ext4_ext_get_actual_len(path->p_ext)); in ext4_ext_binsearch()
866 BUG_ON(chex != path->p_ext); in ext4_ext_binsearch()
891 struct ext4_ext_path *path = orig_path ? *orig_path : NULL; in ext4_find_extent() local
908 if (path) { in ext4_find_extent()
909 ext4_ext_drop_refs(path); in ext4_find_extent()
910 if (depth > path[0].p_maxdepth) { in ext4_find_extent()
911 kfree(path); in ext4_find_extent()
912 *orig_path = path = NULL; in ext4_find_extent()
915 if (!path) { in ext4_find_extent()
917 path = kcalloc(depth + 2, sizeof(struct ext4_ext_path), in ext4_find_extent()
919 if (unlikely(!path)) in ext4_find_extent()
921 path[0].p_maxdepth = depth + 1; in ext4_find_extent()
923 path[0].p_hdr = eh; in ext4_find_extent()
924 path[0].p_bh = NULL; in ext4_find_extent()
934 ext4_ext_binsearch_idx(inode, path + ppos, block); in ext4_find_extent()
935 path[ppos].p_block = ext4_idx_pblock(path[ppos].p_idx); in ext4_find_extent()
936 path[ppos].p_depth = i; in ext4_find_extent()
937 path[ppos].p_ext = NULL; in ext4_find_extent()
939 bh = read_extent_tree_block(inode, path[ppos].p_idx, --i, flags); in ext4_find_extent()
947 path[ppos].p_bh = bh; in ext4_find_extent()
948 path[ppos].p_hdr = eh; in ext4_find_extent()
951 path[ppos].p_depth = i; in ext4_find_extent()
952 path[ppos].p_ext = NULL; in ext4_find_extent()
953 path[ppos].p_idx = NULL; in ext4_find_extent()
956 ext4_ext_binsearch(inode, path + ppos, block); in ext4_find_extent()
958 if (path[ppos].p_ext) in ext4_find_extent()
959 path[ppos].p_block = ext4_ext_pblock(path[ppos].p_ext); in ext4_find_extent()
961 ext4_ext_show_path(inode, path); in ext4_find_extent()
963 return path; in ext4_find_extent()
966 ext4_ext_drop_refs(path); in ext4_find_extent()
967 kfree(path); in ext4_find_extent()
1058 struct ext4_ext_path *path, in ext4_ext_split() argument
1081 if (unlikely(path[depth].p_ext > EXT_MAX_EXTENT(path[depth].p_hdr))) { in ext4_ext_split()
1085 if (path[depth].p_ext != EXT_MAX_EXTENT(path[depth].p_hdr)) { in ext4_ext_split()
1086 border = path[depth].p_ext[1].ee_block; in ext4_ext_split()
1116 newblock = ext4_ext_new_meta_block(handle, inode, path, in ext4_ext_split()
1149 if (unlikely(path[depth].p_hdr->eh_entries != in ext4_ext_split()
1150 path[depth].p_hdr->eh_max)) { in ext4_ext_split()
1152 path[depth].p_hdr->eh_entries, in ext4_ext_split()
1153 path[depth].p_hdr->eh_max); in ext4_ext_split()
1158 m = EXT_MAX_EXTENT(path[depth].p_hdr) - path[depth].p_ext++; in ext4_ext_split()
1159 ext4_ext_show_move(inode, path, newblock, depth); in ext4_ext_split()
1163 memmove(ex, path[depth].p_ext, sizeof(struct ext4_extent) * m); in ext4_ext_split()
1183 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_split()
1186 le16_add_cpu(&path[depth].p_hdr->eh_entries, -m); in ext4_ext_split()
1187 err = ext4_ext_dirty(handle, inode, path + depth); in ext4_ext_split()
1233 if (unlikely(EXT_MAX_INDEX(path[i].p_hdr) != in ext4_ext_split()
1234 EXT_LAST_INDEX(path[i].p_hdr))) { in ext4_ext_split()
1237 le32_to_cpu(path[i].p_ext->ee_block)); in ext4_ext_split()
1242 m = EXT_MAX_INDEX(path[i].p_hdr) - path[i].p_idx++; in ext4_ext_split()
1243 ext_debug(inode, "cur 0x%p, last 0x%p\n", path[i].p_idx, in ext4_ext_split()
1244 EXT_MAX_INDEX(path[i].p_hdr)); in ext4_ext_split()
1245 ext4_ext_show_move(inode, path, newblock, i); in ext4_ext_split()
1247 memmove(++fidx, path[i].p_idx, in ext4_ext_split()
1268 err = ext4_ext_get_access(handle, inode, path + i); in ext4_ext_split()
1271 le16_add_cpu(&path[i].p_hdr->eh_entries, -m); in ext4_ext_split()
1272 err = ext4_ext_dirty(handle, inode, path + i); in ext4_ext_split()
1281 err = ext4_ext_insert_index(handle, inode, path + at, in ext4_ext_split()
1404 struct ext4_ext_path *path = *ppath; in ext4_ext_create_new_leaf() local
1412 curp = path + depth; in ext4_ext_create_new_leaf()
1423 err = ext4_ext_split(handle, inode, mb_flags, path, newext, i); in ext4_ext_create_new_leaf()
1428 path = ext4_find_extent(inode, in ext4_ext_create_new_leaf()
1431 if (IS_ERR(path)) in ext4_ext_create_new_leaf()
1432 err = PTR_ERR(path); in ext4_ext_create_new_leaf()
1440 path = ext4_find_extent(inode, in ext4_ext_create_new_leaf()
1443 if (IS_ERR(path)) { in ext4_ext_create_new_leaf()
1444 err = PTR_ERR(path); in ext4_ext_create_new_leaf()
1453 if (path[depth].p_hdr->eh_entries == path[depth].p_hdr->eh_max) { in ext4_ext_create_new_leaf()
1471 struct ext4_ext_path *path, in ext4_ext_search_left() argument
1478 if (unlikely(path == NULL)) { in ext4_ext_search_left()
1482 depth = path->p_depth; in ext4_ext_search_left()
1485 if (depth == 0 && path->p_ext == NULL) in ext4_ext_search_left()
1492 ex = path[depth].p_ext; in ext4_ext_search_left()
1495 if (unlikely(EXT_FIRST_EXTENT(path[depth].p_hdr) != ex)) { in ext4_ext_search_left()
1502 ix = path[depth].p_idx; in ext4_ext_search_left()
1503 if (unlikely(ix != EXT_FIRST_INDEX(path[depth].p_hdr))) { in ext4_ext_search_left()
1507 EXT_FIRST_INDEX(path[depth].p_hdr) != NULL ? in ext4_ext_search_left()
1508 le32_to_cpu(EXT_FIRST_INDEX(path[depth].p_hdr)->ei_block) : 0, in ext4_ext_search_left()
1536 struct ext4_ext_path *path, in ext4_ext_search_right() argument
1547 if (unlikely(path == NULL)) { in ext4_ext_search_right()
1551 depth = path->p_depth; in ext4_ext_search_right()
1554 if (depth == 0 && path->p_ext == NULL) in ext4_ext_search_right()
1561 ex = path[depth].p_ext; in ext4_ext_search_right()
1564 if (unlikely(EXT_FIRST_EXTENT(path[depth].p_hdr) != ex)) { in ext4_ext_search_right()
1571 ix = path[depth].p_idx; in ext4_ext_search_right()
1572 if (unlikely(ix != EXT_FIRST_INDEX(path[depth].p_hdr))) { in ext4_ext_search_right()
1589 if (ex != EXT_LAST_EXTENT(path[depth].p_hdr)) { in ext4_ext_search_right()
1597 ix = path[depth].p_idx; in ext4_ext_search_right()
1598 if (ix != EXT_LAST_INDEX(path[depth].p_hdr)) in ext4_ext_search_right()
1610 while (++depth < path->p_depth) { in ext4_ext_search_right()
1612 bh = read_extent_tree_block(inode, ix, path->p_depth - depth, 0); in ext4_ext_search_right()
1620 bh = read_extent_tree_block(inode, ix, path->p_depth - depth, 0); in ext4_ext_search_right()
1643 ext4_ext_next_allocated_block(struct ext4_ext_path *path) in ext4_ext_next_allocated_block() argument
1647 BUG_ON(path == NULL); in ext4_ext_next_allocated_block()
1648 depth = path->p_depth; in ext4_ext_next_allocated_block()
1650 if (depth == 0 && path->p_ext == NULL) in ext4_ext_next_allocated_block()
1654 struct ext4_ext_path *p = &path[depth]; in ext4_ext_next_allocated_block()
1656 if (depth == path->p_depth) { in ext4_ext_next_allocated_block()
1675 static ext4_lblk_t ext4_ext_next_leaf_block(struct ext4_ext_path *path) in ext4_ext_next_leaf_block() argument
1679 BUG_ON(path == NULL); in ext4_ext_next_leaf_block()
1680 depth = path->p_depth; in ext4_ext_next_leaf_block()
1690 if (path[depth].p_idx != in ext4_ext_next_leaf_block()
1691 EXT_LAST_INDEX(path[depth].p_hdr)) in ext4_ext_next_leaf_block()
1693 le32_to_cpu(path[depth].p_idx[1].ei_block); in ext4_ext_next_leaf_block()
1707 struct ext4_ext_path *path) in ext4_ext_correct_indexes() argument
1715 eh = path[depth].p_hdr; in ext4_ext_correct_indexes()
1716 ex = path[depth].p_ext; in ext4_ext_correct_indexes()
1738 border = path[depth].p_ext->ee_block; in ext4_ext_correct_indexes()
1739 err = ext4_ext_get_access(handle, inode, path + k); in ext4_ext_correct_indexes()
1742 path[k].p_idx->ei_block = border; in ext4_ext_correct_indexes()
1743 err = ext4_ext_dirty(handle, inode, path + k); in ext4_ext_correct_indexes()
1749 if (path[k+1].p_idx != EXT_FIRST_INDEX(path[k+1].p_hdr)) in ext4_ext_correct_indexes()
1751 err = ext4_ext_get_access(handle, inode, path + k); in ext4_ext_correct_indexes()
1754 path[k].p_idx->ei_block = border; in ext4_ext_correct_indexes()
1755 err = ext4_ext_dirty(handle, inode, path + k); in ext4_ext_correct_indexes()
1803 struct ext4_ext_path *path, in ext4_ext_try_to_merge_right() argument
1811 BUG_ON(path[depth].p_hdr == NULL); in ext4_ext_try_to_merge_right()
1812 eh = path[depth].p_hdr; in ext4_ext_try_to_merge_right()
1845 struct ext4_ext_path *path) in ext4_ext_try_to_merge_up() argument
1851 if ((path[0].p_depth != 1) || in ext4_ext_try_to_merge_up()
1852 (le16_to_cpu(path[0].p_hdr->eh_entries) != 1) || in ext4_ext_try_to_merge_up()
1853 (le16_to_cpu(path[1].p_hdr->eh_entries) > max_root)) in ext4_ext_try_to_merge_up()
1868 blk = ext4_idx_pblock(path[0].p_idx); in ext4_ext_try_to_merge_up()
1869 s = le16_to_cpu(path[1].p_hdr->eh_entries) * in ext4_ext_try_to_merge_up()
1873 path[1].p_maxdepth = path[0].p_maxdepth; in ext4_ext_try_to_merge_up()
1874 memcpy(path[0].p_hdr, path[1].p_hdr, s); in ext4_ext_try_to_merge_up()
1875 path[0].p_depth = 0; in ext4_ext_try_to_merge_up()
1876 path[0].p_ext = EXT_FIRST_EXTENT(path[0].p_hdr) + in ext4_ext_try_to_merge_up()
1877 (path[1].p_ext - EXT_FIRST_EXTENT(path[1].p_hdr)); in ext4_ext_try_to_merge_up()
1878 path[0].p_hdr->eh_max = cpu_to_le16(max_root); in ext4_ext_try_to_merge_up()
1880 brelse(path[1].p_bh); in ext4_ext_try_to_merge_up()
1891 struct ext4_ext_path *path, in ext4_ext_try_to_merge() argument
1899 BUG_ON(path[depth].p_hdr == NULL); in ext4_ext_try_to_merge()
1900 eh = path[depth].p_hdr; in ext4_ext_try_to_merge()
1903 merge_done = ext4_ext_try_to_merge_right(inode, path, ex - 1); in ext4_ext_try_to_merge()
1906 (void) ext4_ext_try_to_merge_right(inode, path, ex); in ext4_ext_try_to_merge()
1908 ext4_ext_try_to_merge_up(handle, inode, path); in ext4_ext_try_to_merge()
1922 struct ext4_ext_path *path) in ext4_ext_check_overlap() argument
1931 if (!path[depth].p_ext) in ext4_ext_check_overlap()
1933 b2 = EXT4_LBLK_CMASK(sbi, le32_to_cpu(path[depth].p_ext->ee_block)); in ext4_ext_check_overlap()
1940 b2 = ext4_ext_next_allocated_block(path); in ext4_ext_check_overlap()
1972 struct ext4_ext_path *path = *ppath; in ext4_ext_insert_extent() local
1988 ex = path[depth].p_ext; in ext4_ext_insert_extent()
1989 eh = path[depth].p_hdr; in ext4_ext_insert_extent()
1990 if (unlikely(path[depth].p_hdr == NULL)) { in ext4_ext_insert_extent()
2028 path + depth); in ext4_ext_insert_extent()
2036 eh = path[depth].p_hdr; in ext4_ext_insert_extent()
2054 path + depth); in ext4_ext_insert_extent()
2065 eh = path[depth].p_hdr; in ext4_ext_insert_extent()
2072 eh = path[depth].p_hdr; in ext4_ext_insert_extent()
2080 next = ext4_ext_next_leaf_block(path); in ext4_ext_insert_extent()
2087 BUG_ON(npath->p_depth != path->p_depth); in ext4_ext_insert_extent()
2092 path = npath; in ext4_ext_insert_extent()
2110 eh = path[depth].p_hdr; in ext4_ext_insert_extent()
2113 nearex = path[depth].p_ext; in ext4_ext_insert_extent()
2115 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_insert_extent()
2165 path[depth].p_ext = nearex; in ext4_ext_insert_extent()
2173 ext4_ext_try_to_merge(handle, inode, path, nearex); in ext4_ext_insert_extent()
2177 err = ext4_ext_correct_indexes(handle, inode, path); in ext4_ext_insert_extent()
2181 err = ext4_ext_dirty(handle, inode, path + path->p_depth); in ext4_ext_insert_extent()
2249 struct ext4_ext_path *path, in ext4_ext_determine_hole() argument
2256 ex = path[depth].p_ext; in ext4_ext_determine_hole()
2268 next = ext4_ext_next_allocated_block(path); in ext4_ext_determine_hole()
2306 struct ext4_ext_path *path, int depth) in ext4_ext_rm_idx() argument
2313 path = path + depth; in ext4_ext_rm_idx()
2314 leaf = ext4_idx_pblock(path->p_idx); in ext4_ext_rm_idx()
2315 if (unlikely(path->p_hdr->eh_entries == 0)) { in ext4_ext_rm_idx()
2319 err = ext4_ext_get_access(handle, inode, path); in ext4_ext_rm_idx()
2323 if (path->p_idx != EXT_LAST_INDEX(path->p_hdr)) { in ext4_ext_rm_idx()
2324 int len = EXT_LAST_INDEX(path->p_hdr) - path->p_idx; in ext4_ext_rm_idx()
2326 memmove(path->p_idx, path->p_idx + 1, len); in ext4_ext_rm_idx()
2329 le16_add_cpu(&path->p_hdr->eh_entries, -1); in ext4_ext_rm_idx()
2330 err = ext4_ext_dirty(handle, inode, path); in ext4_ext_rm_idx()
2340 if (path->p_idx != EXT_FIRST_INDEX(path->p_hdr)) in ext4_ext_rm_idx()
2342 path--; in ext4_ext_rm_idx()
2343 err = ext4_ext_get_access(handle, inode, path); in ext4_ext_rm_idx()
2346 path->p_idx->ei_block = (path+1)->p_idx->ei_block; in ext4_ext_rm_idx()
2347 err = ext4_ext_dirty(handle, inode, path); in ext4_ext_rm_idx()
2362 struct ext4_ext_path *path) in ext4_ext_calc_credits_for_single_extent() argument
2364 if (path) { in ext4_ext_calc_credits_for_single_extent()
2369 if (le16_to_cpu(path[depth].p_hdr->eh_entries) in ext4_ext_calc_credits_for_single_extent()
2370 < le16_to_cpu(path[depth].p_hdr->eh_max)) { in ext4_ext_calc_credits_for_single_extent()
2595 struct ext4_ext_path *path, in ext4_ext_rm_leaf() argument
2613 if (!path[depth].p_hdr) in ext4_ext_rm_leaf()
2614 path[depth].p_hdr = ext_block_hdr(path[depth].p_bh); in ext4_ext_rm_leaf()
2615 eh = path[depth].p_hdr; in ext4_ext_rm_leaf()
2616 if (unlikely(path[depth].p_hdr == NULL)) { in ext4_ext_rm_leaf()
2621 ex = path[depth].p_ext; in ext4_ext_rm_leaf()
2640 path[depth].p_ext = ex; in ext4_ext_rm_leaf()
2711 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_rm_leaf()
2751 err = ext4_ext_dirty(handle, inode, path + depth); in ext4_ext_rm_leaf()
2763 err = ext4_ext_correct_indexes(handle, inode, path); in ext4_ext_rm_leaf()
2790 if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL) in ext4_ext_rm_leaf()
2791 err = ext4_ext_rm_idx(handle, inode, path, depth); in ext4_ext_rm_leaf()
2802 ext4_ext_more_to_rm(struct ext4_ext_path *path) in ext4_ext_more_to_rm() argument
2804 BUG_ON(path->p_idx == NULL); in ext4_ext_more_to_rm()
2806 if (path->p_idx < EXT_FIRST_INDEX(path->p_hdr)) in ext4_ext_more_to_rm()
2813 if (le16_to_cpu(path->p_hdr->eh_entries) == path->p_block) in ext4_ext_more_to_rm()
2823 struct ext4_ext_path *path = NULL; in ext4_ext_remove_space() local
2857 path = ext4_find_extent(inode, end, NULL, in ext4_ext_remove_space()
2859 if (IS_ERR(path)) { in ext4_ext_remove_space()
2861 return PTR_ERR(path); in ext4_ext_remove_space()
2865 ex = path[depth].p_ext; in ext4_ext_remove_space()
2904 err = ext4_force_split_extent_at(handle, inode, &path, in ext4_ext_remove_space()
2922 err = ext4_ext_search_right(inode, path, &lblk, &pblk, in ext4_ext_remove_space()
2937 if (path) { in ext4_ext_remove_space()
2940 path[k].p_block = in ext4_ext_remove_space()
2941 le16_to_cpu(path[k].p_hdr->eh_entries)+1; in ext4_ext_remove_space()
2943 path = kcalloc(depth + 1, sizeof(struct ext4_ext_path), in ext4_ext_remove_space()
2945 if (path == NULL) { in ext4_ext_remove_space()
2949 path[0].p_maxdepth = path[0].p_depth = depth; in ext4_ext_remove_space()
2950 path[0].p_hdr = ext_inode_hdr(inode); in ext4_ext_remove_space()
2953 if (ext4_ext_check(inode, path[0].p_hdr, depth, 0)) { in ext4_ext_remove_space()
2963 err = ext4_ext_rm_leaf(handle, inode, path, in ext4_ext_remove_space()
2966 brelse(path[i].p_bh); in ext4_ext_remove_space()
2967 path[i].p_bh = NULL; in ext4_ext_remove_space()
2973 if (!path[i].p_hdr) { in ext4_ext_remove_space()
2975 path[i].p_hdr = ext_block_hdr(path[i].p_bh); in ext4_ext_remove_space()
2978 if (!path[i].p_idx) { in ext4_ext_remove_space()
2980 path[i].p_idx = EXT_LAST_INDEX(path[i].p_hdr); in ext4_ext_remove_space()
2981 path[i].p_block = le16_to_cpu(path[i].p_hdr->eh_entries)+1; in ext4_ext_remove_space()
2983 path[i].p_hdr, in ext4_ext_remove_space()
2984 le16_to_cpu(path[i].p_hdr->eh_entries)); in ext4_ext_remove_space()
2987 path[i].p_idx--; in ext4_ext_remove_space()
2991 i, EXT_FIRST_INDEX(path[i].p_hdr), in ext4_ext_remove_space()
2992 path[i].p_idx); in ext4_ext_remove_space()
2993 if (ext4_ext_more_to_rm(path + i)) { in ext4_ext_remove_space()
2997 i + 1, ext4_idx_pblock(path[i].p_idx)); in ext4_ext_remove_space()
2998 memset(path + i + 1, 0, sizeof(*path)); in ext4_ext_remove_space()
2999 bh = read_extent_tree_block(inode, path[i].p_idx, in ext4_ext_remove_space()
3014 path[i + 1].p_bh = bh; in ext4_ext_remove_space()
3018 path[i].p_block = le16_to_cpu(path[i].p_hdr->eh_entries); in ext4_ext_remove_space()
3022 if (path[i].p_hdr->eh_entries == 0 && i > 0) { in ext4_ext_remove_space()
3026 err = ext4_ext_rm_idx(handle, inode, path, i); in ext4_ext_remove_space()
3029 brelse(path[i].p_bh); in ext4_ext_remove_space()
3030 path[i].p_bh = NULL; in ext4_ext_remove_space()
3037 path->p_hdr->eh_entries); in ext4_ext_remove_space()
3057 if (path->p_hdr->eh_entries == 0) { in ext4_ext_remove_space()
3062 err = ext4_ext_get_access(handle, inode, path); in ext4_ext_remove_space()
3067 err = ext4_ext_dirty(handle, inode, path); in ext4_ext_remove_space()
3071 ext4_ext_drop_refs(path); in ext4_ext_remove_space()
3072 kfree(path); in ext4_ext_remove_space()
3073 path = NULL; in ext4_ext_remove_space()
3189 struct ext4_ext_path *path = *ppath; in ext4_split_extent_at() local
3202 ext4_ext_show_leaf(inode, path); in ext4_split_extent_at()
3205 ex = path[depth].p_ext; in ext4_split_extent_at()
3216 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_split_extent_at()
3232 ext4_ext_try_to_merge(handle, inode, path, ex); in ext4_split_extent_at()
3234 err = ext4_ext_dirty(handle, inode, path + path->p_depth); in ext4_split_extent_at()
3248 err = ext4_ext_dirty(handle, inode, path + depth); in ext4_split_extent_at()
3292 ext4_ext_try_to_merge(handle, inode, path, ex); in ext4_split_extent_at()
3293 err = ext4_ext_dirty(handle, inode, path + path->p_depth); in ext4_split_extent_at()
3312 ext4_ext_dirty(handle, inode, path + path->p_depth); in ext4_split_extent_at()
3315 ext4_ext_show_leaf(inode, path); in ext4_split_extent_at()
3337 struct ext4_ext_path *path = *ppath; in ext4_split_extent() local
3347 ex = path[depth].p_ext; in ext4_split_extent()
3371 path = ext4_find_extent(inode, map->m_lblk, ppath, flags); in ext4_split_extent()
3372 if (IS_ERR(path)) in ext4_split_extent()
3373 return PTR_ERR(path); in ext4_split_extent()
3375 ex = path[depth].p_ext; in ext4_split_extent()
3397 ext4_ext_show_leaf(inode, path); in ext4_split_extent()
3428 struct ext4_ext_path *path = *ppath; in ext4_ext_convert_to_initialized() local
3450 eh = path[depth].p_hdr; in ext4_ext_convert_to_initialized()
3451 ex = path[depth].p_ext; in ext4_ext_convert_to_initialized()
3505 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_convert_to_initialized()
3551 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_convert_to_initialized()
3573 err = ext4_ext_dirty(handle, inode, path + depth); in ext4_ext_convert_to_initialized()
3576 path[depth].p_ext = abut_ex; in ext4_ext_convert_to_initialized()
3687 struct ext4_ext_path *path = *ppath; in ext4_split_convert_extents() local
3706 ex = path[depth].p_ext; in ext4_split_convert_extents()
3728 struct ext4_ext_path *path = *ppath; in ext4_convert_unwritten_extents_endio() local
3736 ex = path[depth].p_ext; in ext4_convert_unwritten_extents_endio()
3760 path = ext4_find_extent(inode, map->m_lblk, ppath, 0); in ext4_convert_unwritten_extents_endio()
3761 if (IS_ERR(path)) in ext4_convert_unwritten_extents_endio()
3762 return PTR_ERR(path); in ext4_convert_unwritten_extents_endio()
3764 ex = path[depth].p_ext; in ext4_convert_unwritten_extents_endio()
3767 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_convert_unwritten_extents_endio()
3776 ext4_ext_try_to_merge(handle, inode, path, ex); in ext4_convert_unwritten_extents_endio()
3779 err = ext4_ext_dirty(handle, inode, path + path->p_depth); in ext4_convert_unwritten_extents_endio()
3781 ext4_ext_show_leaf(inode, path); in ext4_convert_unwritten_extents_endio()
3791 struct ext4_ext_path *path = *ppath; in convert_initialized_extent() local
3806 ex = path[depth].p_ext; in convert_initialized_extent()
3818 path = ext4_find_extent(inode, map->m_lblk, ppath, 0); in convert_initialized_extent()
3819 if (IS_ERR(path)) in convert_initialized_extent()
3820 return PTR_ERR(path); in convert_initialized_extent()
3822 ex = path[depth].p_ext; in convert_initialized_extent()
3830 err = ext4_ext_get_access(handle, inode, path + depth); in convert_initialized_extent()
3839 ext4_ext_try_to_merge(handle, inode, path, ex); in convert_initialized_extent()
3842 err = ext4_ext_dirty(handle, inode, path + path->p_depth); in convert_initialized_extent()
3845 ext4_ext_show_leaf(inode, path); in convert_initialized_extent()
3862 struct ext4_ext_path __maybe_unused *path = *ppath; in ext4_ext_handle_unwritten_extents() local
3869 ext4_ext_show_leaf(inode, path); in ext4_ext_handle_unwritten_extents()
3966 ext4_ext_show_leaf(inode, path); in ext4_ext_handle_unwritten_extents()
4015 struct ext4_ext_path *path) in get_implied_cluster_alloc() argument
4061 ext4_lblk_t next = ext4_ext_next_allocated_block(path); in get_implied_cluster_alloc()
4095 struct ext4_ext_path *path = NULL; in ext4_ext_map_blocks() local
4109 path = ext4_find_extent(inode, map->m_lblk, NULL, 0); in ext4_ext_map_blocks()
4110 if (IS_ERR(path)) { in ext4_ext_map_blocks()
4111 err = PTR_ERR(path); in ext4_ext_map_blocks()
4112 path = NULL; in ext4_ext_map_blocks()
4123 if (unlikely(path[depth].p_ext == NULL && depth != 0)) { in ext4_ext_map_blocks()
4127 path[depth].p_block); in ext4_ext_map_blocks()
4132 ex = path[depth].p_ext; in ext4_ext_map_blocks()
4162 inode, map, &path, &allocated); in ext4_ext_map_blocks()
4170 ext4_ext_show_leaf(inode, path); in ext4_ext_map_blocks()
4175 handle, inode, map, &path, flags, in ext4_ext_map_blocks()
4193 hole_len = ext4_ext_determine_hole(inode, path, &hole_start); in ext4_ext_map_blocks()
4220 get_implied_cluster_alloc(inode->i_sb, map, ex, path)) { in ext4_ext_map_blocks()
4228 err = ext4_ext_search_left(inode, path, &ar.lleft, &ar.pleft); in ext4_ext_map_blocks()
4232 err = ext4_ext_search_right(inode, path, &ar.lright, &ar.pright, &ex2); in ext4_ext_map_blocks()
4239 get_implied_cluster_alloc(inode->i_sb, map, &ex2, path)) { in ext4_ext_map_blocks()
4260 err = ext4_ext_check_overlap(sbi, inode, &newex, path); in ext4_ext_map_blocks()
4268 ar.goal = ext4_ext_find_goal(inode, path, map->m_lblk); in ext4_ext_map_blocks()
4314 err = ext4_ext_insert_extent(handle, inode, &path, &newex, flags); in ext4_ext_map_blocks()
4384 ext4_ext_show_leaf(inode, path); in ext4_ext_map_blocks()
4386 ext4_ext_drop_refs(path); in ext4_ext_map_blocks()
4387 kfree(path); in ext4_ext_map_blocks()
5034 ext4_ext_shift_path_extents(struct ext4_ext_path *path, ext4_lblk_t shift, in ext4_ext_shift_path_extents() argument
5042 depth = path->p_depth; in ext4_ext_shift_path_extents()
5045 if (depth == path->p_depth) { in ext4_ext_shift_path_extents()
5046 ex_start = path[depth].p_ext; in ext4_ext_shift_path_extents()
5050 ex_last = EXT_LAST_EXTENT(path[depth].p_hdr); in ext4_ext_shift_path_extents()
5053 if (ex_start == EXT_FIRST_EXTENT(path[depth].p_hdr)) { in ext4_ext_shift_path_extents()
5068 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_shift_path_extents()
5078 EXT_FIRST_EXTENT(path[depth].p_hdr)) in ext4_ext_shift_path_extents()
5081 path, ex_start - 1)) in ext4_ext_shift_path_extents()
5087 ext4_ext_try_to_merge_right(inode, path, in ext4_ext_shift_path_extents()
5092 err = ext4_ext_dirty(handle, inode, path + depth); in ext4_ext_shift_path_extents()
5101 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_shift_path_extents()
5106 le32_add_cpu(&path[depth].p_idx->ei_block, -shift); in ext4_ext_shift_path_extents()
5108 le32_add_cpu(&path[depth].p_idx->ei_block, shift); in ext4_ext_shift_path_extents()
5109 err = ext4_ext_dirty(handle, inode, path + depth); in ext4_ext_shift_path_extents()
5114 if (path[depth].p_idx != EXT_FIRST_INDEX(path[depth].p_hdr)) in ext4_ext_shift_path_extents()
5136 struct ext4_ext_path *path; in ext4_ext_shift_extents() local
5143 path = ext4_find_extent(inode, EXT_MAX_BLOCKS - 1, NULL, in ext4_ext_shift_extents()
5145 if (IS_ERR(path)) in ext4_ext_shift_extents()
5146 return PTR_ERR(path); in ext4_ext_shift_extents()
5148 depth = path->p_depth; in ext4_ext_shift_extents()
5149 extent = path[depth].p_ext; in ext4_ext_shift_extents()
5161 path = ext4_find_extent(inode, start - 1, &path, in ext4_ext_shift_extents()
5163 if (IS_ERR(path)) in ext4_ext_shift_extents()
5164 return PTR_ERR(path); in ext4_ext_shift_extents()
5165 depth = path->p_depth; in ext4_ext_shift_extents()
5166 extent = path[depth].p_ext; in ext4_ext_shift_extents()
5210 path = ext4_find_extent(inode, *iterator, &path, in ext4_ext_shift_extents()
5212 if (IS_ERR(path)) in ext4_ext_shift_extents()
5213 return PTR_ERR(path); in ext4_ext_shift_extents()
5214 depth = path->p_depth; in ext4_ext_shift_extents()
5215 extent = path[depth].p_ext; in ext4_ext_shift_extents()
5224 if (extent < EXT_LAST_EXTENT(path[depth].p_hdr)) { in ext4_ext_shift_extents()
5225 path[depth].p_ext++; in ext4_ext_shift_extents()
5227 *iterator = ext4_ext_next_allocated_block(path); in ext4_ext_shift_extents()
5234 extent = EXT_LAST_EXTENT(path[depth].p_hdr); in ext4_ext_shift_extents()
5238 extent = EXT_FIRST_EXTENT(path[depth].p_hdr); in ext4_ext_shift_extents()
5244 extent = EXT_LAST_EXTENT(path[depth].p_hdr); in ext4_ext_shift_extents()
5248 if (extent == EXT_LAST_EXTENT(path[depth].p_hdr)) in ext4_ext_shift_extents()
5254 path[depth].p_ext = extent; in ext4_ext_shift_extents()
5256 ret = ext4_ext_shift_path_extents(path, shift, inode, in ext4_ext_shift_extents()
5265 ext4_ext_drop_refs(path); in ext4_ext_shift_extents()
5266 kfree(path); in ext4_ext_shift_extents()
5431 struct ext4_ext_path *path; in ext4_insert_range() local
5529 path = ext4_find_extent(inode, offset_lblk, NULL, 0); in ext4_insert_range()
5530 if (IS_ERR(path)) { in ext4_insert_range()
5536 extent = path[depth].p_ext; in ext4_insert_range()
5550 ret = ext4_split_extent_at(handle, inode, &path, in ext4_insert_range()
5557 ext4_ext_drop_refs(path); in ext4_insert_range()
5558 kfree(path); in ext4_insert_range()
5564 ext4_ext_drop_refs(path); in ext4_insert_range()
5565 kfree(path); in ext4_insert_range()
5810 struct ext4_ext_path *path; in ext4_clu_mapped() local
5825 path = ext4_find_extent(inode, EXT4_C2B(sbi, lclu), NULL, 0); in ext4_clu_mapped()
5826 if (IS_ERR(path)) { in ext4_clu_mapped()
5827 err = PTR_ERR(path); in ext4_clu_mapped()
5828 path = NULL; in ext4_clu_mapped()
5839 if (unlikely(path[depth].p_ext == NULL && depth != 0)) { in ext4_clu_mapped()
5843 depth, path[depth].p_block); in ext4_clu_mapped()
5848 extent = path[depth].p_ext; in ext4_clu_mapped()
5869 first_lblk = ext4_ext_next_allocated_block(path); in ext4_clu_mapped()
5877 ext4_ext_drop_refs(path); in ext4_clu_mapped()
5878 kfree(path); in ext4_clu_mapped()
5893 struct ext4_ext_path *path = NULL, *ppath; in ext4_ext_replay_update_ex() local
5897 path = ext4_find_extent(inode, start, NULL, 0); in ext4_ext_replay_update_ex()
5898 if (IS_ERR(path)) in ext4_ext_replay_update_ex()
5899 return PTR_ERR(path); in ext4_ext_replay_update_ex()
5900 ex = path[path->p_depth].p_ext; in ext4_ext_replay_update_ex()
5909 ppath = path; in ext4_ext_replay_update_ex()
5915 kfree(path); in ext4_ext_replay_update_ex()
5916 path = ext4_find_extent(inode, start, NULL, 0); in ext4_ext_replay_update_ex()
5917 if (IS_ERR(path)) in ext4_ext_replay_update_ex()
5919 ppath = path; in ext4_ext_replay_update_ex()
5920 ex = path[path->p_depth].p_ext; in ext4_ext_replay_update_ex()
5929 kfree(path); in ext4_ext_replay_update_ex()
5930 path = ext4_find_extent(inode, start, NULL, 0); in ext4_ext_replay_update_ex()
5931 if (IS_ERR(path)) in ext4_ext_replay_update_ex()
5933 ex = path[path->p_depth].p_ext; in ext4_ext_replay_update_ex()
5942 ret = ext4_ext_dirty(NULL, inode, &path[path->p_depth]); in ext4_ext_replay_update_ex()
5945 ext4_ext_drop_refs(path); in ext4_ext_replay_update_ex()
5946 kfree(path); in ext4_ext_replay_update_ex()
5954 struct ext4_ext_path *path = NULL; in ext4_ext_replay_shrink_inode() local
5959 path = ext4_find_extent(inode, cur, NULL, 0); in ext4_ext_replay_shrink_inode()
5960 if (IS_ERR(path)) in ext4_ext_replay_shrink_inode()
5962 ex = path[path->p_depth].p_ext; in ext4_ext_replay_shrink_inode()
5964 ext4_ext_drop_refs(path); in ext4_ext_replay_shrink_inode()
5965 kfree(path); in ext4_ext_replay_shrink_inode()
5973 ext4_ext_try_to_merge(NULL, inode, path, ex); in ext4_ext_replay_shrink_inode()
5975 ext4_ext_dirty(NULL, inode, &path[path->p_depth]); in ext4_ext_replay_shrink_inode()
5978 ext4_ext_drop_refs(path); in ext4_ext_replay_shrink_inode()
5979 kfree(path); in ext4_ext_replay_shrink_inode()
6004 struct ext4_ext_path *path = NULL, *path2 = NULL; in ext4_ext_replay_set_iblocks() local
6012 path = ext4_find_extent(inode, EXT_MAX_BLOCKS - 1, NULL, in ext4_ext_replay_set_iblocks()
6014 if (IS_ERR(path)) in ext4_ext_replay_set_iblocks()
6015 return PTR_ERR(path); in ext4_ext_replay_set_iblocks()
6016 ex = path[path->p_depth].p_ext; in ext4_ext_replay_set_iblocks()
6018 ext4_ext_drop_refs(path); in ext4_ext_replay_set_iblocks()
6019 kfree(path); in ext4_ext_replay_set_iblocks()
6023 ext4_ext_drop_refs(path); in ext4_ext_replay_set_iblocks()
6024 kfree(path); in ext4_ext_replay_set_iblocks()
6050 path = ext4_find_extent(inode, cur, NULL, 0); in ext4_ext_replay_set_iblocks()
6051 if (IS_ERR(path)) in ext4_ext_replay_set_iblocks()
6053 numblks += path->p_depth; in ext4_ext_replay_set_iblocks()
6054 ext4_ext_drop_refs(path); in ext4_ext_replay_set_iblocks()
6055 kfree(path); in ext4_ext_replay_set_iblocks()
6057 path = ext4_find_extent(inode, cur, NULL, 0); in ext4_ext_replay_set_iblocks()
6058 if (IS_ERR(path)) in ext4_ext_replay_set_iblocks()
6060 ex = path[path->p_depth].p_ext; in ext4_ext_replay_set_iblocks()
6062 ext4_ext_drop_refs(path); in ext4_ext_replay_set_iblocks()
6063 kfree(path); in ext4_ext_replay_set_iblocks()
6070 ext4_ext_drop_refs(path); in ext4_ext_replay_set_iblocks()
6071 kfree(path); in ext4_ext_replay_set_iblocks()
6076 ext4_ext_drop_refs(path); in ext4_ext_replay_set_iblocks()
6077 kfree(path); in ext4_ext_replay_set_iblocks()
6081 for (i = 0; i <= max(path->p_depth, path2->p_depth); i++) { in ext4_ext_replay_set_iblocks()
6083 if (i <= path->p_depth) in ext4_ext_replay_set_iblocks()
6084 cmp1 = path[i].p_bh ? in ext4_ext_replay_set_iblocks()
6085 path[i].p_bh->b_blocknr : 0; in ext4_ext_replay_set_iblocks()
6092 ext4_ext_drop_refs(path); in ext4_ext_replay_set_iblocks()
6094 kfree(path); in ext4_ext_replay_set_iblocks()
6106 struct ext4_ext_path *path = NULL; in ext4_ext_clear_bb() local
6113 path = ext4_find_extent(inode, EXT_MAX_BLOCKS - 1, NULL, in ext4_ext_clear_bb()
6115 if (IS_ERR(path)) in ext4_ext_clear_bb()
6116 return PTR_ERR(path); in ext4_ext_clear_bb()
6117 ex = path[path->p_depth].p_ext; in ext4_ext_clear_bb()
6119 ext4_ext_drop_refs(path); in ext4_ext_clear_bb()
6120 kfree(path); in ext4_ext_clear_bb()
6124 ext4_ext_drop_refs(path); in ext4_ext_clear_bb()
6125 kfree(path); in ext4_ext_clear_bb()
6135 path = ext4_find_extent(inode, map.m_lblk, NULL, 0); in ext4_ext_clear_bb()
6136 if (!IS_ERR_OR_NULL(path)) { in ext4_ext_clear_bb()
6137 for (j = 0; j < path->p_depth; j++) { in ext4_ext_clear_bb()
6140 path[j].p_block, 1, 0); in ext4_ext_clear_bb()
6142 0, path[j].p_block, 1, 1); in ext4_ext_clear_bb()
6144 ext4_ext_drop_refs(path); in ext4_ext_clear_bb()
6145 kfree(path); in ext4_ext_clear_bb()