Lines Matching refs:path
134 struct ext4_ext_path *path) in ext4_ext_get_access() argument
136 if (path->p_bh) { in ext4_ext_get_access()
138 BUFFER_TRACE(path->p_bh, "get_write_access"); in ext4_ext_get_access()
139 return ext4_journal_get_write_access(handle, path->p_bh); in ext4_ext_get_access()
153 struct inode *inode, struct ext4_ext_path *path) in __ext4_ext_dirty() argument
158 if (path->p_bh) { in __ext4_ext_dirty()
159 ext4_extent_block_csum_set(inode, ext_block_hdr(path->p_bh)); in __ext4_ext_dirty()
162 inode, path->p_bh); in __ext4_ext_dirty()
171 struct ext4_ext_path *path, in ext4_ext_find_goal() argument
174 if (path) { in ext4_ext_find_goal()
175 int depth = path->p_depth; in ext4_ext_find_goal()
195 ex = path[depth].p_ext; in ext4_ext_find_goal()
208 if (path[depth].p_bh) in ext4_ext_find_goal()
209 return path[depth].p_bh->b_blocknr; in ext4_ext_find_goal()
221 struct ext4_ext_path *path, in ext4_ext_new_meta_block() argument
226 goal = ext4_ext_find_goal(inode, path, le32_to_cpu(ex->ee_block)); in ext4_ext_new_meta_block()
291 struct ext4_ext_path *path = *ppath; in ext4_force_split_extent_at() local
292 int unwritten = ext4_ext_is_unwritten(path[path->p_depth].p_ext); in ext4_force_split_extent_at()
570 struct ext4_ext_path *path = NULL; in ext4_ext_precache() local
580 path = kcalloc(depth + 1, sizeof(struct ext4_ext_path), in ext4_ext_precache()
582 if (path == NULL) { in ext4_ext_precache()
590 path[0].p_hdr = ext_inode_hdr(inode); in ext4_ext_precache()
591 ret = ext4_ext_check(inode, path[0].p_hdr, depth, 0); in ext4_ext_precache()
594 path[0].p_idx = EXT_FIRST_INDEX(path[0].p_hdr); in ext4_ext_precache()
601 path[i].p_idx > EXT_LAST_INDEX(path[i].p_hdr)) { in ext4_ext_precache()
602 brelse(path[i].p_bh); in ext4_ext_precache()
603 path[i].p_bh = NULL; in ext4_ext_precache()
608 ext4_idx_pblock(path[i].p_idx++), in ext4_ext_precache()
616 path[i].p_bh = bh; in ext4_ext_precache()
617 path[i].p_hdr = ext_block_hdr(bh); in ext4_ext_precache()
618 path[i].p_idx = EXT_FIRST_INDEX(path[i].p_hdr); in ext4_ext_precache()
623 ext4_ext_drop_refs(path); in ext4_ext_precache()
624 kfree(path); in ext4_ext_precache()
629 static void ext4_ext_show_path(struct inode *inode, struct ext4_ext_path *path) in ext4_ext_show_path() argument
631 int k, l = path->p_depth; in ext4_ext_show_path()
634 for (k = 0; k <= l; k++, path++) { in ext4_ext_show_path()
635 if (path->p_idx) { in ext4_ext_show_path()
636 ext_debug(" %d->%llu", le32_to_cpu(path->p_idx->ei_block), in ext4_ext_show_path()
637 ext4_idx_pblock(path->p_idx)); in ext4_ext_show_path()
638 } else if (path->p_ext) { in ext4_ext_show_path()
640 le32_to_cpu(path->p_ext->ee_block), in ext4_ext_show_path()
641 ext4_ext_is_unwritten(path->p_ext), in ext4_ext_show_path()
642 ext4_ext_get_actual_len(path->p_ext), in ext4_ext_show_path()
643 ext4_ext_pblock(path->p_ext)); in ext4_ext_show_path()
650 static void ext4_ext_show_leaf(struct inode *inode, struct ext4_ext_path *path) in ext4_ext_show_leaf() argument
657 if (!path) in ext4_ext_show_leaf()
660 eh = path[depth].p_hdr; in ext4_ext_show_leaf()
673 static void ext4_ext_show_move(struct inode *inode, struct ext4_ext_path *path, in ext4_ext_show_move() argument
681 idx = path[level].p_idx; in ext4_ext_show_move()
682 while (idx <= EXT_MAX_INDEX(path[level].p_hdr)) { in ext4_ext_show_move()
693 ex = path[depth].p_ext; in ext4_ext_show_move()
694 while (ex <= EXT_MAX_EXTENT(path[depth].p_hdr)) { in ext4_ext_show_move()
706 #define ext4_ext_show_path(inode, path) argument
707 #define ext4_ext_show_leaf(inode, path) argument
708 #define ext4_ext_show_move(inode, path, newblock, level) argument
711 void ext4_ext_drop_refs(struct ext4_ext_path *path) in ext4_ext_drop_refs() argument
715 if (!path) in ext4_ext_drop_refs()
717 depth = path->p_depth; in ext4_ext_drop_refs()
718 for (i = 0; i <= depth; i++, path++) in ext4_ext_drop_refs()
719 if (path->p_bh) { in ext4_ext_drop_refs()
720 brelse(path->p_bh); in ext4_ext_drop_refs()
721 path->p_bh = NULL; in ext4_ext_drop_refs()
732 struct ext4_ext_path *path, ext4_lblk_t block) in ext4_ext_binsearch_idx() argument
734 struct ext4_extent_header *eh = path->p_hdr; in ext4_ext_binsearch_idx()
753 path->p_idx = l - 1; in ext4_ext_binsearch_idx()
754 ext_debug(" -> %u->%lld ", le32_to_cpu(path->p_idx->ei_block), in ext4_ext_binsearch_idx()
755 ext4_idx_pblock(path->p_idx)); in ext4_ext_binsearch_idx()
779 BUG_ON(chix != path->p_idx); in ext4_ext_binsearch_idx()
792 struct ext4_ext_path *path, ext4_lblk_t block) in ext4_ext_binsearch() argument
794 struct ext4_extent_header *eh = path->p_hdr; in ext4_ext_binsearch()
821 path->p_ext = l - 1; in ext4_ext_binsearch()
823 le32_to_cpu(path->p_ext->ee_block), in ext4_ext_binsearch()
824 ext4_ext_pblock(path->p_ext), in ext4_ext_binsearch()
825 ext4_ext_is_unwritten(path->p_ext), in ext4_ext_binsearch()
826 ext4_ext_get_actual_len(path->p_ext)); in ext4_ext_binsearch()
841 BUG_ON(chex != path->p_ext); in ext4_ext_binsearch()
866 struct ext4_ext_path *path = orig_path ? *orig_path : NULL; in ext4_find_extent() local
879 if (path) { in ext4_find_extent()
880 ext4_ext_drop_refs(path); in ext4_find_extent()
881 if (depth > path[0].p_maxdepth) { in ext4_find_extent()
882 kfree(path); in ext4_find_extent()
883 *orig_path = path = NULL; in ext4_find_extent()
886 if (!path) { in ext4_find_extent()
888 path = kcalloc(depth + 2, sizeof(struct ext4_ext_path), in ext4_find_extent()
890 if (unlikely(!path)) in ext4_find_extent()
892 path[0].p_maxdepth = depth + 1; in ext4_find_extent()
894 path[0].p_hdr = eh; in ext4_find_extent()
895 path[0].p_bh = NULL; in ext4_find_extent()
903 ext4_ext_binsearch_idx(inode, path + ppos, block); in ext4_find_extent()
904 path[ppos].p_block = ext4_idx_pblock(path[ppos].p_idx); in ext4_find_extent()
905 path[ppos].p_depth = i; in ext4_find_extent()
906 path[ppos].p_ext = NULL; in ext4_find_extent()
908 bh = read_extent_tree_block(inode, path[ppos].p_block, --i, in ext4_find_extent()
917 path[ppos].p_bh = bh; in ext4_find_extent()
918 path[ppos].p_hdr = eh; in ext4_find_extent()
921 path[ppos].p_depth = i; in ext4_find_extent()
922 path[ppos].p_ext = NULL; in ext4_find_extent()
923 path[ppos].p_idx = NULL; in ext4_find_extent()
926 ext4_ext_binsearch(inode, path + ppos, block); in ext4_find_extent()
928 if (path[ppos].p_ext) in ext4_find_extent()
929 path[ppos].p_block = ext4_ext_pblock(path[ppos].p_ext); in ext4_find_extent()
931 ext4_ext_show_path(inode, path); in ext4_find_extent()
933 return path; in ext4_find_extent()
936 ext4_ext_drop_refs(path); in ext4_find_extent()
937 kfree(path); in ext4_find_extent()
1026 struct ext4_ext_path *path, in ext4_ext_split() argument
1044 if (unlikely(path[depth].p_ext > EXT_MAX_EXTENT(path[depth].p_hdr))) { in ext4_ext_split()
1048 if (path[depth].p_ext != EXT_MAX_EXTENT(path[depth].p_hdr)) { in ext4_ext_split()
1049 border = path[depth].p_ext[1].ee_block; in ext4_ext_split()
1079 newblock = ext4_ext_new_meta_block(handle, inode, path, in ext4_ext_split()
1111 if (unlikely(path[depth].p_hdr->eh_entries != in ext4_ext_split()
1112 path[depth].p_hdr->eh_max)) { in ext4_ext_split()
1114 path[depth].p_hdr->eh_entries, in ext4_ext_split()
1115 path[depth].p_hdr->eh_max); in ext4_ext_split()
1120 m = EXT_MAX_EXTENT(path[depth].p_hdr) - path[depth].p_ext++; in ext4_ext_split()
1121 ext4_ext_show_move(inode, path, newblock, depth); in ext4_ext_split()
1125 memmove(ex, path[depth].p_ext, sizeof(struct ext4_extent) * m); in ext4_ext_split()
1141 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_split()
1144 le16_add_cpu(&path[depth].p_hdr->eh_entries, -m); in ext4_ext_split()
1145 err = ext4_ext_dirty(handle, inode, path + depth); in ext4_ext_split()
1190 if (unlikely(EXT_MAX_INDEX(path[i].p_hdr) != in ext4_ext_split()
1191 EXT_LAST_INDEX(path[i].p_hdr))) { in ext4_ext_split()
1194 le32_to_cpu(path[i].p_ext->ee_block)); in ext4_ext_split()
1199 m = EXT_MAX_INDEX(path[i].p_hdr) - path[i].p_idx++; in ext4_ext_split()
1200 ext_debug("cur 0x%p, last 0x%p\n", path[i].p_idx, in ext4_ext_split()
1201 EXT_MAX_INDEX(path[i].p_hdr)); in ext4_ext_split()
1202 ext4_ext_show_move(inode, path, newblock, i); in ext4_ext_split()
1204 memmove(++fidx, path[i].p_idx, in ext4_ext_split()
1220 err = ext4_ext_get_access(handle, inode, path + i); in ext4_ext_split()
1223 le16_add_cpu(&path[i].p_hdr->eh_entries, -m); in ext4_ext_split()
1224 err = ext4_ext_dirty(handle, inode, path + i); in ext4_ext_split()
1233 err = ext4_ext_insert_index(handle, inode, path + at, in ext4_ext_split()
1353 struct ext4_ext_path *path = *ppath; in ext4_ext_create_new_leaf() local
1361 curp = path + depth; in ext4_ext_create_new_leaf()
1372 err = ext4_ext_split(handle, inode, mb_flags, path, newext, i); in ext4_ext_create_new_leaf()
1377 path = ext4_find_extent(inode, in ext4_ext_create_new_leaf()
1380 if (IS_ERR(path)) in ext4_ext_create_new_leaf()
1381 err = PTR_ERR(path); in ext4_ext_create_new_leaf()
1389 path = ext4_find_extent(inode, in ext4_ext_create_new_leaf()
1392 if (IS_ERR(path)) { in ext4_ext_create_new_leaf()
1393 err = PTR_ERR(path); in ext4_ext_create_new_leaf()
1402 if (path[depth].p_hdr->eh_entries == path[depth].p_hdr->eh_max) { in ext4_ext_create_new_leaf()
1420 struct ext4_ext_path *path, in ext4_ext_search_left() argument
1427 if (unlikely(path == NULL)) { in ext4_ext_search_left()
1431 depth = path->p_depth; in ext4_ext_search_left()
1434 if (depth == 0 && path->p_ext == NULL) in ext4_ext_search_left()
1441 ex = path[depth].p_ext; in ext4_ext_search_left()
1444 if (unlikely(EXT_FIRST_EXTENT(path[depth].p_hdr) != ex)) { in ext4_ext_search_left()
1451 ix = path[depth].p_idx; in ext4_ext_search_left()
1452 if (unlikely(ix != EXT_FIRST_INDEX(path[depth].p_hdr))) { in ext4_ext_search_left()
1456 EXT_FIRST_INDEX(path[depth].p_hdr) != NULL ? in ext4_ext_search_left()
1457 le32_to_cpu(EXT_FIRST_INDEX(path[depth].p_hdr)->ei_block) : 0, in ext4_ext_search_left()
1485 struct ext4_ext_path *path, in ext4_ext_search_right() argument
1497 if (unlikely(path == NULL)) { in ext4_ext_search_right()
1501 depth = path->p_depth; in ext4_ext_search_right()
1504 if (depth == 0 && path->p_ext == NULL) in ext4_ext_search_right()
1511 ex = path[depth].p_ext; in ext4_ext_search_right()
1514 if (unlikely(EXT_FIRST_EXTENT(path[depth].p_hdr) != ex)) { in ext4_ext_search_right()
1521 ix = path[depth].p_idx; in ext4_ext_search_right()
1522 if (unlikely(ix != EXT_FIRST_INDEX(path[depth].p_hdr))) { in ext4_ext_search_right()
1539 if (ex != EXT_LAST_EXTENT(path[depth].p_hdr)) { in ext4_ext_search_right()
1547 ix = path[depth].p_idx; in ext4_ext_search_right()
1548 if (ix != EXT_LAST_INDEX(path[depth].p_hdr)) in ext4_ext_search_right()
1561 while (++depth < path->p_depth) { in ext4_ext_search_right()
1564 path->p_depth - depth, 0); in ext4_ext_search_right()
1573 bh = read_extent_tree_block(inode, block, path->p_depth - depth, 0); in ext4_ext_search_right()
1595 ext4_ext_next_allocated_block(struct ext4_ext_path *path) in ext4_ext_next_allocated_block() argument
1599 BUG_ON(path == NULL); in ext4_ext_next_allocated_block()
1600 depth = path->p_depth; in ext4_ext_next_allocated_block()
1602 if (depth == 0 && path->p_ext == NULL) in ext4_ext_next_allocated_block()
1606 if (depth == path->p_depth) { in ext4_ext_next_allocated_block()
1608 if (path[depth].p_ext && in ext4_ext_next_allocated_block()
1609 path[depth].p_ext != in ext4_ext_next_allocated_block()
1610 EXT_LAST_EXTENT(path[depth].p_hdr)) in ext4_ext_next_allocated_block()
1611 return le32_to_cpu(path[depth].p_ext[1].ee_block); in ext4_ext_next_allocated_block()
1614 if (path[depth].p_idx != in ext4_ext_next_allocated_block()
1615 EXT_LAST_INDEX(path[depth].p_hdr)) in ext4_ext_next_allocated_block()
1616 return le32_to_cpu(path[depth].p_idx[1].ei_block); in ext4_ext_next_allocated_block()
1628 static ext4_lblk_t ext4_ext_next_leaf_block(struct ext4_ext_path *path) in ext4_ext_next_leaf_block() argument
1632 BUG_ON(path == NULL); in ext4_ext_next_leaf_block()
1633 depth = path->p_depth; in ext4_ext_next_leaf_block()
1643 if (path[depth].p_idx != in ext4_ext_next_leaf_block()
1644 EXT_LAST_INDEX(path[depth].p_hdr)) in ext4_ext_next_leaf_block()
1646 le32_to_cpu(path[depth].p_idx[1].ei_block); in ext4_ext_next_leaf_block()
1660 struct ext4_ext_path *path) in ext4_ext_correct_indexes() argument
1668 eh = path[depth].p_hdr; in ext4_ext_correct_indexes()
1669 ex = path[depth].p_ext; in ext4_ext_correct_indexes()
1691 border = path[depth].p_ext->ee_block; in ext4_ext_correct_indexes()
1692 err = ext4_ext_get_access(handle, inode, path + k); in ext4_ext_correct_indexes()
1695 path[k].p_idx->ei_block = border; in ext4_ext_correct_indexes()
1696 err = ext4_ext_dirty(handle, inode, path + k); in ext4_ext_correct_indexes()
1702 if (path[k+1].p_idx != EXT_FIRST_INDEX(path[k+1].p_hdr)) in ext4_ext_correct_indexes()
1704 err = ext4_ext_get_access(handle, inode, path + k); in ext4_ext_correct_indexes()
1707 path[k].p_idx->ei_block = border; in ext4_ext_correct_indexes()
1708 err = ext4_ext_dirty(handle, inode, path + k); in ext4_ext_correct_indexes()
1768 struct ext4_ext_path *path, in ext4_ext_try_to_merge_right() argument
1776 BUG_ON(path[depth].p_hdr == NULL); in ext4_ext_try_to_merge_right()
1777 eh = path[depth].p_hdr; in ext4_ext_try_to_merge_right()
1810 struct ext4_ext_path *path) in ext4_ext_try_to_merge_up() argument
1816 if ((path[0].p_depth != 1) || in ext4_ext_try_to_merge_up()
1817 (le16_to_cpu(path[0].p_hdr->eh_entries) != 1) || in ext4_ext_try_to_merge_up()
1818 (le16_to_cpu(path[1].p_hdr->eh_entries) > max_root)) in ext4_ext_try_to_merge_up()
1832 blk = ext4_idx_pblock(path[0].p_idx); in ext4_ext_try_to_merge_up()
1833 s = le16_to_cpu(path[1].p_hdr->eh_entries) * in ext4_ext_try_to_merge_up()
1837 path[1].p_maxdepth = path[0].p_maxdepth; in ext4_ext_try_to_merge_up()
1838 memcpy(path[0].p_hdr, path[1].p_hdr, s); in ext4_ext_try_to_merge_up()
1839 path[0].p_depth = 0; in ext4_ext_try_to_merge_up()
1840 path[0].p_ext = EXT_FIRST_EXTENT(path[0].p_hdr) + in ext4_ext_try_to_merge_up()
1841 (path[1].p_ext - EXT_FIRST_EXTENT(path[1].p_hdr)); in ext4_ext_try_to_merge_up()
1842 path[0].p_hdr->eh_max = cpu_to_le16(max_root); in ext4_ext_try_to_merge_up()
1844 brelse(path[1].p_bh); in ext4_ext_try_to_merge_up()
1855 struct ext4_ext_path *path, in ext4_ext_try_to_merge() argument
1862 BUG_ON(path[depth].p_hdr == NULL); in ext4_ext_try_to_merge()
1863 eh = path[depth].p_hdr; in ext4_ext_try_to_merge()
1866 merge_done = ext4_ext_try_to_merge_right(inode, path, ex - 1); in ext4_ext_try_to_merge()
1869 (void) ext4_ext_try_to_merge_right(inode, path, ex); in ext4_ext_try_to_merge()
1871 ext4_ext_try_to_merge_up(handle, inode, path); in ext4_ext_try_to_merge()
1885 struct ext4_ext_path *path) in ext4_ext_check_overlap() argument
1894 if (!path[depth].p_ext) in ext4_ext_check_overlap()
1896 b2 = EXT4_LBLK_CMASK(sbi, le32_to_cpu(path[depth].p_ext->ee_block)); in ext4_ext_check_overlap()
1903 b2 = ext4_ext_next_allocated_block(path); in ext4_ext_check_overlap()
1935 struct ext4_ext_path *path = *ppath; in ext4_ext_insert_extent() local
1951 ex = path[depth].p_ext; in ext4_ext_insert_extent()
1952 eh = path[depth].p_hdr; in ext4_ext_insert_extent()
1953 if (unlikely(path[depth].p_hdr == NULL)) { in ext4_ext_insert_extent()
1991 path + depth); in ext4_ext_insert_extent()
1999 eh = path[depth].p_hdr; in ext4_ext_insert_extent()
2017 path + depth); in ext4_ext_insert_extent()
2028 eh = path[depth].p_hdr; in ext4_ext_insert_extent()
2035 eh = path[depth].p_hdr; in ext4_ext_insert_extent()
2043 next = ext4_ext_next_leaf_block(path); in ext4_ext_insert_extent()
2050 BUG_ON(npath->p_depth != path->p_depth); in ext4_ext_insert_extent()
2055 path = npath; in ext4_ext_insert_extent()
2073 eh = path[depth].p_hdr; in ext4_ext_insert_extent()
2076 nearex = path[depth].p_ext; in ext4_ext_insert_extent()
2078 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_insert_extent()
2128 path[depth].p_ext = nearex; in ext4_ext_insert_extent()
2136 ext4_ext_try_to_merge(handle, inode, path, nearex); in ext4_ext_insert_extent()
2140 err = ext4_ext_correct_indexes(handle, inode, path); in ext4_ext_insert_extent()
2144 err = ext4_ext_dirty(handle, inode, path + path->p_depth); in ext4_ext_insert_extent()
2156 struct ext4_ext_path *path = NULL; in ext4_fill_fiemap_extents() local
2170 path = ext4_find_extent(inode, block, &path, 0); in ext4_fill_fiemap_extents()
2171 if (IS_ERR(path)) { in ext4_fill_fiemap_extents()
2173 err = PTR_ERR(path); in ext4_fill_fiemap_extents()
2174 path = NULL; in ext4_fill_fiemap_extents()
2179 if (unlikely(path[depth].p_hdr == NULL)) { in ext4_fill_fiemap_extents()
2185 ex = path[depth].p_ext; in ext4_fill_fiemap_extents()
2186 next = ext4_ext_next_allocated_block(path); in ext4_fill_fiemap_extents()
2296 ext4_ext_drop_refs(path); in ext4_fill_fiemap_extents()
2297 kfree(path); in ext4_fill_fiemap_extents()
2315 struct ext4_ext_path *path, in ext4_ext_determine_hole() argument
2322 ex = path[depth].p_ext; in ext4_ext_determine_hole()
2334 next = ext4_ext_next_allocated_block(path); in ext4_ext_determine_hole()
2372 struct ext4_ext_path *path, int depth) in ext4_ext_rm_idx() argument
2379 path = path + depth; in ext4_ext_rm_idx()
2380 leaf = ext4_idx_pblock(path->p_idx); in ext4_ext_rm_idx()
2381 if (unlikely(path->p_hdr->eh_entries == 0)) { in ext4_ext_rm_idx()
2385 err = ext4_ext_get_access(handle, inode, path); in ext4_ext_rm_idx()
2389 if (path->p_idx != EXT_LAST_INDEX(path->p_hdr)) { in ext4_ext_rm_idx()
2390 int len = EXT_LAST_INDEX(path->p_hdr) - path->p_idx; in ext4_ext_rm_idx()
2392 memmove(path->p_idx, path->p_idx + 1, len); in ext4_ext_rm_idx()
2395 le16_add_cpu(&path->p_hdr->eh_entries, -1); in ext4_ext_rm_idx()
2396 err = ext4_ext_dirty(handle, inode, path); in ext4_ext_rm_idx()
2406 if (path->p_idx != EXT_FIRST_INDEX(path->p_hdr)) in ext4_ext_rm_idx()
2408 path--; in ext4_ext_rm_idx()
2409 err = ext4_ext_get_access(handle, inode, path); in ext4_ext_rm_idx()
2412 path->p_idx->ei_block = (path+1)->p_idx->ei_block; in ext4_ext_rm_idx()
2413 err = ext4_ext_dirty(handle, inode, path); in ext4_ext_rm_idx()
2428 struct ext4_ext_path *path) in ext4_ext_calc_credits_for_single_extent() argument
2430 if (path) { in ext4_ext_calc_credits_for_single_extent()
2435 if (le16_to_cpu(path[depth].p_hdr->eh_entries) in ext4_ext_calc_credits_for_single_extent()
2436 < le16_to_cpu(path[depth].p_hdr->eh_max)) { in ext4_ext_calc_credits_for_single_extent()
2610 struct ext4_ext_path *path, in ext4_ext_rm_leaf() argument
2628 if (!path[depth].p_hdr) in ext4_ext_rm_leaf()
2629 path[depth].p_hdr = ext_block_hdr(path[depth].p_bh); in ext4_ext_rm_leaf()
2630 eh = path[depth].p_hdr; in ext4_ext_rm_leaf()
2631 if (unlikely(path[depth].p_hdr == NULL)) { in ext4_ext_rm_leaf()
2636 ex = path[depth].p_ext; in ext4_ext_rm_leaf()
2655 path[depth].p_ext = ex; in ext4_ext_rm_leaf()
2713 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_rm_leaf()
2754 err = ext4_ext_dirty(handle, inode, path + depth); in ext4_ext_rm_leaf()
2766 err = ext4_ext_correct_indexes(handle, inode, path); in ext4_ext_rm_leaf()
2788 if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL) in ext4_ext_rm_leaf()
2789 err = ext4_ext_rm_idx(handle, inode, path, depth); in ext4_ext_rm_leaf()
2800 ext4_ext_more_to_rm(struct ext4_ext_path *path) in ext4_ext_more_to_rm() argument
2802 BUG_ON(path->p_idx == NULL); in ext4_ext_more_to_rm()
2804 if (path->p_idx < EXT_FIRST_INDEX(path->p_hdr)) in ext4_ext_more_to_rm()
2811 if (le16_to_cpu(path->p_hdr->eh_entries) == path->p_block) in ext4_ext_more_to_rm()
2821 struct ext4_ext_path *path = NULL; in ext4_ext_remove_space() local
2849 path = ext4_find_extent(inode, end, NULL, EXT4_EX_NOCACHE); in ext4_ext_remove_space()
2850 if (IS_ERR(path)) { in ext4_ext_remove_space()
2852 return PTR_ERR(path); in ext4_ext_remove_space()
2856 ex = path[depth].p_ext; in ext4_ext_remove_space()
2895 err = ext4_force_split_extent_at(handle, inode, &path, in ext4_ext_remove_space()
2910 err = ext4_ext_search_right(inode, path, &lblk, &pblk, in ext4_ext_remove_space()
2924 if (path) { in ext4_ext_remove_space()
2927 path[k].p_block = in ext4_ext_remove_space()
2928 le16_to_cpu(path[k].p_hdr->eh_entries)+1; in ext4_ext_remove_space()
2930 path = kcalloc(depth + 1, sizeof(struct ext4_ext_path), in ext4_ext_remove_space()
2932 if (path == NULL) { in ext4_ext_remove_space()
2936 path[0].p_maxdepth = path[0].p_depth = depth; in ext4_ext_remove_space()
2937 path[0].p_hdr = ext_inode_hdr(inode); in ext4_ext_remove_space()
2940 if (ext4_ext_check(inode, path[0].p_hdr, depth, 0)) { in ext4_ext_remove_space()
2950 err = ext4_ext_rm_leaf(handle, inode, path, in ext4_ext_remove_space()
2954 brelse(path[i].p_bh); in ext4_ext_remove_space()
2955 path[i].p_bh = NULL; in ext4_ext_remove_space()
2961 if (!path[i].p_hdr) { in ext4_ext_remove_space()
2963 path[i].p_hdr = ext_block_hdr(path[i].p_bh); in ext4_ext_remove_space()
2966 if (!path[i].p_idx) { in ext4_ext_remove_space()
2968 path[i].p_idx = EXT_LAST_INDEX(path[i].p_hdr); in ext4_ext_remove_space()
2969 path[i].p_block = le16_to_cpu(path[i].p_hdr->eh_entries)+1; in ext4_ext_remove_space()
2971 path[i].p_hdr, in ext4_ext_remove_space()
2972 le16_to_cpu(path[i].p_hdr->eh_entries)); in ext4_ext_remove_space()
2975 path[i].p_idx--; in ext4_ext_remove_space()
2979 i, EXT_FIRST_INDEX(path[i].p_hdr), in ext4_ext_remove_space()
2980 path[i].p_idx); in ext4_ext_remove_space()
2981 if (ext4_ext_more_to_rm(path + i)) { in ext4_ext_remove_space()
2985 i + 1, ext4_idx_pblock(path[i].p_idx)); in ext4_ext_remove_space()
2986 memset(path + i + 1, 0, sizeof(*path)); in ext4_ext_remove_space()
2988 ext4_idx_pblock(path[i].p_idx), depth - i - 1, in ext4_ext_remove_space()
3002 path[i + 1].p_bh = bh; in ext4_ext_remove_space()
3006 path[i].p_block = le16_to_cpu(path[i].p_hdr->eh_entries); in ext4_ext_remove_space()
3010 if (path[i].p_hdr->eh_entries == 0 && i > 0) { in ext4_ext_remove_space()
3014 err = ext4_ext_rm_idx(handle, inode, path, i); in ext4_ext_remove_space()
3017 brelse(path[i].p_bh); in ext4_ext_remove_space()
3018 path[i].p_bh = NULL; in ext4_ext_remove_space()
3025 partial_cluster, path->p_hdr->eh_entries); in ext4_ext_remove_space()
3042 if (path->p_hdr->eh_entries == 0) { in ext4_ext_remove_space()
3047 err = ext4_ext_get_access(handle, inode, path); in ext4_ext_remove_space()
3052 err = ext4_ext_dirty(handle, inode, path); in ext4_ext_remove_space()
3056 ext4_ext_drop_refs(path); in ext4_ext_remove_space()
3057 kfree(path); in ext4_ext_remove_space()
3058 path = NULL; in ext4_ext_remove_space()
3174 struct ext4_ext_path *path = *ppath; in ext4_split_extent_at() local
3188 ext4_ext_show_leaf(inode, path); in ext4_split_extent_at()
3191 ex = path[depth].p_ext; in ext4_split_extent_at()
3202 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_split_extent_at()
3218 ext4_ext_try_to_merge(handle, inode, path, ex); in ext4_split_extent_at()
3220 err = ext4_ext_dirty(handle, inode, path + path->p_depth); in ext4_split_extent_at()
3234 err = ext4_ext_dirty(handle, inode, path + depth); in ext4_split_extent_at()
3276 ext4_ext_try_to_merge(handle, inode, path, ex); in ext4_split_extent_at()
3277 err = ext4_ext_dirty(handle, inode, path + path->p_depth); in ext4_split_extent_at()
3289 ext4_ext_show_leaf(inode, path); in ext4_split_extent_at()
3294 ext4_ext_dirty(handle, inode, path + path->p_depth); in ext4_split_extent_at()
3316 struct ext4_ext_path *path = *ppath; in ext4_split_extent() local
3326 ex = path[depth].p_ext; in ext4_split_extent()
3350 path = ext4_find_extent(inode, map->m_lblk, ppath, 0); in ext4_split_extent()
3351 if (IS_ERR(path)) in ext4_split_extent()
3352 return PTR_ERR(path); in ext4_split_extent()
3354 ex = path[depth].p_ext; in ext4_split_extent()
3376 ext4_ext_show_leaf(inode, path); in ext4_split_extent()
3407 struct ext4_ext_path *path = *ppath; in ext4_ext_convert_to_initialized() local
3430 eh = path[depth].p_hdr; in ext4_ext_convert_to_initialized()
3431 ex = path[depth].p_ext; in ext4_ext_convert_to_initialized()
3485 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_convert_to_initialized()
3531 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_ext_convert_to_initialized()
3553 ext4_ext_dirty(handle, inode, path + depth); in ext4_ext_convert_to_initialized()
3556 path[depth].p_ext = abut_ex; in ext4_ext_convert_to_initialized()
3669 struct ext4_ext_path *path = *ppath; in ext4_split_convert_extents() local
3689 ex = path[depth].p_ext; in ext4_split_convert_extents()
3711 struct ext4_ext_path *path = *ppath; in ext4_convert_unwritten_extents_endio() local
3719 ex = path[depth].p_ext; in ext4_convert_unwritten_extents_endio()
3744 path = ext4_find_extent(inode, map->m_lblk, ppath, 0); in ext4_convert_unwritten_extents_endio()
3745 if (IS_ERR(path)) in ext4_convert_unwritten_extents_endio()
3746 return PTR_ERR(path); in ext4_convert_unwritten_extents_endio()
3748 ex = path[depth].p_ext; in ext4_convert_unwritten_extents_endio()
3751 err = ext4_ext_get_access(handle, inode, path + depth); in ext4_convert_unwritten_extents_endio()
3760 ext4_ext_try_to_merge(handle, inode, path, ex); in ext4_convert_unwritten_extents_endio()
3763 err = ext4_ext_dirty(handle, inode, path + path->p_depth); in ext4_convert_unwritten_extents_endio()
3765 ext4_ext_show_leaf(inode, path); in ext4_convert_unwritten_extents_endio()
3774 struct ext4_ext_path *path, in check_eofblocks_fl() argument
3785 eh = path[depth].p_hdr; in check_eofblocks_fl()
3815 if (path[i].p_idx != EXT_LAST_INDEX(path[i].p_hdr)) in check_eofblocks_fl()
3936 struct ext4_ext_path *path = *ppath; in convert_initialized_extent() local
3951 ex = path[depth].p_ext; in convert_initialized_extent()
3964 path = ext4_find_extent(inode, map->m_lblk, ppath, 0); in convert_initialized_extent()
3965 if (IS_ERR(path)) in convert_initialized_extent()
3966 return PTR_ERR(path); in convert_initialized_extent()
3968 ex = path[depth].p_ext; in convert_initialized_extent()
3976 err = ext4_ext_get_access(handle, inode, path + depth); in convert_initialized_extent()
3985 ext4_ext_try_to_merge(handle, inode, path, ex); in convert_initialized_extent()
3988 err = ext4_ext_dirty(handle, inode, path + path->p_depth); in convert_initialized_extent()
3991 ext4_ext_show_leaf(inode, path); in convert_initialized_extent()
3994 err = check_eofblocks_fl(handle, inode, map->m_lblk, path, map->m_len); in convert_initialized_extent()
4010 struct ext4_ext_path *path = *ppath; in ext4_ext_handle_unwritten_extents() local
4018 ext4_ext_show_leaf(inode, path); in ext4_ext_handle_unwritten_extents()
4053 path, map->m_len); in ext4_ext_handle_unwritten_extents()
4131 err = check_eofblocks_fl(handle, inode, map->m_lblk, path, in ext4_ext_handle_unwritten_extents()
4139 ext4_ext_show_leaf(inode, path); in ext4_ext_handle_unwritten_extents()
4190 struct ext4_ext_path *path) in get_implied_cluster_alloc() argument
4236 ext4_lblk_t next = ext4_ext_next_allocated_block(path); in get_implied_cluster_alloc()
4270 struct ext4_ext_path *path = NULL; in ext4_ext_map_blocks() local
4286 path = ext4_find_extent(inode, map->m_lblk, NULL, 0); in ext4_ext_map_blocks()
4287 if (IS_ERR(path)) { in ext4_ext_map_blocks()
4288 err = PTR_ERR(path); in ext4_ext_map_blocks()
4289 path = NULL; in ext4_ext_map_blocks()
4300 if (unlikely(path[depth].p_ext == NULL && depth != 0)) { in ext4_ext_map_blocks()
4304 path[depth].p_block); in ext4_ext_map_blocks()
4309 ex = path[depth].p_ext; in ext4_ext_map_blocks()
4339 handle, inode, map, &path, in ext4_ext_map_blocks()
4346 handle, inode, map, &path, flags, in ext4_ext_map_blocks()
4364 hole_len = ext4_ext_determine_hole(inode, path, &hole_start); in ext4_ext_map_blocks()
4391 get_implied_cluster_alloc(inode->i_sb, map, ex, path)) { in ext4_ext_map_blocks()
4400 err = ext4_ext_search_left(inode, path, &ar.lleft, &ar.pleft); in ext4_ext_map_blocks()
4405 err = ext4_ext_search_right(inode, path, &ar.lright, &ar.pright, &ex2); in ext4_ext_map_blocks()
4412 get_implied_cluster_alloc(inode->i_sb, map, ex2, path)) { in ext4_ext_map_blocks()
4434 err = ext4_ext_check_overlap(sbi, inode, &newex, path); in ext4_ext_map_blocks()
4442 ar.goal = ext4_ext_find_goal(inode, path, map->m_lblk); in ext4_ext_map_blocks()
4491 path, ar.len); in ext4_ext_map_blocks()
4493 err = ext4_ext_insert_extent(handle, inode, &path, in ext4_ext_map_blocks()
4601 ext4_ext_show_leaf(inode, path); in ext4_ext_map_blocks()
4606 ext4_ext_drop_refs(path); in ext4_ext_map_blocks()
4607 kfree(path); in ext4_ext_map_blocks()
5206 struct ext4_ext_path *path) in ext4_access_path() argument
5227 err = ext4_ext_get_access(handle, inode, path); in ext4_access_path()
5238 ext4_ext_shift_path_extents(struct ext4_ext_path *path, ext4_lblk_t shift, in ext4_ext_shift_path_extents() argument
5245 depth = path->p_depth; in ext4_ext_shift_path_extents()
5248 if (depth == path->p_depth) { in ext4_ext_shift_path_extents()
5249 ex_start = path[depth].p_ext; in ext4_ext_shift_path_extents()
5253 ex_last = EXT_LAST_EXTENT(path[depth].p_hdr); in ext4_ext_shift_path_extents()
5255 err = ext4_access_path(handle, inode, path + depth); in ext4_ext_shift_path_extents()
5259 if (ex_start == EXT_FIRST_EXTENT(path[depth].p_hdr)) in ext4_ext_shift_path_extents()
5268 EXT_FIRST_EXTENT(path[depth].p_hdr)) in ext4_ext_shift_path_extents()
5271 path, ex_start - 1)) in ext4_ext_shift_path_extents()
5277 ext4_ext_try_to_merge_right(inode, path, in ext4_ext_shift_path_extents()
5282 err = ext4_ext_dirty(handle, inode, path + depth); in ext4_ext_shift_path_extents()
5291 err = ext4_access_path(handle, inode, path + depth); in ext4_ext_shift_path_extents()
5296 le32_add_cpu(&path[depth].p_idx->ei_block, -shift); in ext4_ext_shift_path_extents()
5298 le32_add_cpu(&path[depth].p_idx->ei_block, shift); in ext4_ext_shift_path_extents()
5299 err = ext4_ext_dirty(handle, inode, path + depth); in ext4_ext_shift_path_extents()
5304 if (path[depth].p_idx != EXT_FIRST_INDEX(path[depth].p_hdr)) in ext4_ext_shift_path_extents()
5326 struct ext4_ext_path *path; in ext4_ext_shift_extents() local
5332 path = ext4_find_extent(inode, EXT_MAX_BLOCKS - 1, NULL, in ext4_ext_shift_extents()
5334 if (IS_ERR(path)) in ext4_ext_shift_extents()
5335 return PTR_ERR(path); in ext4_ext_shift_extents()
5337 depth = path->p_depth; in ext4_ext_shift_extents()
5338 extent = path[depth].p_ext; in ext4_ext_shift_extents()
5350 path = ext4_find_extent(inode, start - 1, &path, in ext4_ext_shift_extents()
5352 if (IS_ERR(path)) in ext4_ext_shift_extents()
5353 return PTR_ERR(path); in ext4_ext_shift_extents()
5354 depth = path->p_depth; in ext4_ext_shift_extents()
5355 extent = path[depth].p_ext; in ext4_ext_shift_extents()
5394 path = ext4_find_extent(inode, *iterator, &path, in ext4_ext_shift_extents()
5396 if (IS_ERR(path)) in ext4_ext_shift_extents()
5397 return PTR_ERR(path); in ext4_ext_shift_extents()
5398 depth = path->p_depth; in ext4_ext_shift_extents()
5399 extent = path[depth].p_ext; in ext4_ext_shift_extents()
5408 if (extent < EXT_LAST_EXTENT(path[depth].p_hdr)) { in ext4_ext_shift_extents()
5409 path[depth].p_ext++; in ext4_ext_shift_extents()
5411 *iterator = ext4_ext_next_allocated_block(path); in ext4_ext_shift_extents()
5417 extent = EXT_LAST_EXTENT(path[depth].p_hdr); in ext4_ext_shift_extents()
5421 extent = EXT_FIRST_EXTENT(path[depth].p_hdr); in ext4_ext_shift_extents()
5430 path[depth].p_ext = extent; in ext4_ext_shift_extents()
5432 ret = ext4_ext_shift_path_extents(path, shift, inode, in ext4_ext_shift_extents()
5438 ext4_ext_drop_refs(path); in ext4_ext_shift_extents()
5439 kfree(path); in ext4_ext_shift_extents()
5600 struct ext4_ext_path *path; in ext4_insert_range() local
5697 path = ext4_find_extent(inode, offset_lblk, NULL, 0); in ext4_insert_range()
5698 if (IS_ERR(path)) { in ext4_insert_range()
5704 extent = path[depth].p_ext; in ext4_insert_range()
5718 ret = ext4_split_extent_at(handle, inode, &path, in ext4_insert_range()
5725 ext4_ext_drop_refs(path); in ext4_insert_range()
5726 kfree(path); in ext4_insert_range()
5732 ext4_ext_drop_refs(path); in ext4_insert_range()
5733 kfree(path); in ext4_insert_range()