Lines Matching refs:ex
216 struct ext4_extent *ex;
235 ex = path[depth].p_ext;
236 if (ex) {
237 ext4_fsblk_t ext_pblk = ext4_ext_pblock(ex);
238 ext4_lblk_t ext_block = le32_to_cpu(ex->ee_block);
262 struct ext4_extent *ex, int *err, unsigned int flags)
266 goal = ext4_ext_find_goal(inode, path, le32_to_cpu(ex->ee_block));
526 struct ext4_extent *ex = EXT_FIRST_EXTENT(eh);
530 for (i = le16_to_cpu(eh->eh_entries); i > 0; i--, ex++) {
532 ext4_lblk_t lblk = le32_to_cpu(ex->ee_block);
533 int len = ext4_ext_get_actual_len(ex);
539 if (ext4_ext_is_unwritten(ex))
542 ext4_ext_pblock(ex), status);
689 struct ext4_extent *ex;
696 ex = EXT_FIRST_EXTENT(eh);
700 for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ex++) {
701 ext_debug(inode, "%d:[%d]%d:%llu ", le32_to_cpu(ex->ee_block),
702 ext4_ext_is_unwritten(ex),
703 ext4_ext_get_actual_len(ex), ext4_ext_pblock(ex));
712 struct ext4_extent *ex;
727 ex = path[depth].p_ext;
728 while (ex <= EXT_MAX_EXTENT(path[depth].p_hdr)) {
730 le32_to_cpu(ex->ee_block),
731 ext4_ext_pblock(ex),
732 ext4_ext_is_unwritten(ex),
733 ext4_ext_get_actual_len(ex),
735 ex++;
852 struct ext4_extent *chex, *ex;
855 chex = ex = EXT_FIRST_EXTENT(eh);
856 for (k = 0; k < le16_to_cpu(eh->eh_entries); k++, ex++) {
857 BUG_ON(k && le32_to_cpu(ex->ee_block)
858 <= le32_to_cpu(ex[-1].ee_block));
859 if (block < le32_to_cpu(ex->ee_block))
861 chex = ex;
1158 struct ext4_extent *ex;
1159 ex = EXT_FIRST_EXTENT(neh);
1160 memmove(ex, path[depth].p_ext, sizeof(struct ext4_extent) * m);
1475 struct ext4_extent *ex;
1492 ex = path[depth].p_ext;
1493 ee_len = ext4_ext_get_actual_len(ex);
1494 if (*logical < le32_to_cpu(ex->ee_block)) {
1495 if (unlikely(EXT_FIRST_EXTENT(path[depth].p_hdr) != ex)) {
1497 "EXT_FIRST_EXTENT != ex *logical %d ee_block %d!",
1498 *logical, le32_to_cpu(ex->ee_block));
1515 if (unlikely(*logical < (le32_to_cpu(ex->ee_block) + ee_len))) {
1518 *logical, le32_to_cpu(ex->ee_block), ee_len);
1522 *logical = le32_to_cpu(ex->ee_block) + ee_len - 1;
1523 *phys = ext4_ext_pblock(ex) + ee_len - 1;
1542 struct ext4_extent *ex;
1560 ex = path[depth].p_ext;
1561 ee_len = ext4_ext_get_actual_len(ex);
1562 if (*logical < le32_to_cpu(ex->ee_block)) {
1563 if (unlikely(EXT_FIRST_EXTENT(path[depth].p_hdr) != ex)) {
1565 "first_extent(path[%d].p_hdr) != ex",
1581 if (unlikely(*logical < (le32_to_cpu(ex->ee_block) + ee_len))) {
1584 *logical, le32_to_cpu(ex->ee_block), ee_len);
1588 if (ex != EXT_LAST_EXTENT(path[depth].p_hdr)) {
1590 ex++;
1623 ex = EXT_FIRST_EXTENT(eh);
1625 *logical = le32_to_cpu(ex->ee_block);
1626 *phys = ext4_ext_pblock(ex);
1628 *ret_ex = *ex;
1710 struct ext4_extent *ex;
1715 ex = path[depth].p_ext;
1717 if (unlikely(ex == NULL || eh == NULL)) {
1719 "ex %p == NULL or eh %p == NULL", ex, eh);
1728 if (ex != EXT_FIRST_EXTENT(eh)) {
1795 * This function tries to merge the "ex" extent to the next extent in the tree.
1797 * left, pass "ex - 1" as argument instead of "ex".
1798 * Returns 0 if the extents (ex and ex+1) were _not_ merged and returns
1803 struct ext4_extent *ex)
1813 while (ex < EXT_LAST_EXTENT(eh)) {
1814 if (!ext4_can_extents_be_merged(inode, ex, ex + 1))
1817 unwritten = ext4_ext_is_unwritten(ex);
1818 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex)
1819 + ext4_ext_get_actual_len(ex + 1));
1821 ext4_ext_mark_unwritten(ex);
1823 if (ex + 1 < EXT_LAST_EXTENT(eh)) {
1824 len = (EXT_LAST_EXTENT(eh) - ex - 1)
1826 memmove(ex + 1, ex + 2, len);
1885 * This function tries to merge the @ex extent to neighbours in the tree, then
1891 struct ext4_extent *ex)
1901 if (ex > EXT_FIRST_EXTENT(eh))
1902 merge_done = ext4_ext_try_to_merge_right(inode, path, ex - 1);
1905 (void) ext4_ext_try_to_merge_right(inode, path, ex);
1973 struct ext4_extent *ex, *fex;
1987 ex = path[depth].p_ext;
1995 if (ex && !(gb_flags & EXT4_GET_BLOCKS_PRE_IO)) {
1999 * right from ex, or from the left of ex. This is because
2004 if (ex < EXT_LAST_EXTENT(eh) &&
2005 (le32_to_cpu(ex->ee_block) +
2006 ext4_ext_get_actual_len(ex) <
2008 ex += 1;
2010 } else if ((ex > EXT_FIRST_EXTENT(eh)) &&
2013 le32_to_cpu(ex->ee_block)))
2014 ex -= 1;
2016 /* Try to append newex to the ex */
2017 if (ext4_can_extents_be_merged(inode, ex, newext)) {
2022 le32_to_cpu(ex->ee_block),
2023 ext4_ext_is_unwritten(ex),
2024 ext4_ext_get_actual_len(ex),
2025 ext4_ext_pblock(ex));
2030 unwritten = ext4_ext_is_unwritten(ex);
2031 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex)
2034 ext4_ext_mark_unwritten(ex);
2035 nearex = ex;
2040 /* Try to prepend newex to the ex */
2041 if (ext4_can_extents_be_merged(inode, newext, ex)) {
2047 le32_to_cpu(ex->ee_block),
2048 ext4_ext_is_unwritten(ex),
2049 ext4_ext_get_actual_len(ex),
2050 ext4_ext_pblock(ex));
2056 unwritten = ext4_ext_is_unwritten(ex);
2057 ex->ee_block = newext->ee_block;
2058 ext4_ext_store_pblock(ex, ext4_ext_pblock(newext));
2059 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex)
2062 ext4_ext_mark_unwritten(ex);
2063 nearex = ex;
2249 struct ext4_extent *ex;
2252 ex = path[depth].p_ext;
2253 if (ex == NULL) {
2257 } else if (*lblk < le32_to_cpu(ex->ee_block)) {
2258 len = le32_to_cpu(ex->ee_block) - *lblk;
2259 } else if (*lblk >= le32_to_cpu(ex->ee_block)
2260 + ext4_ext_get_actual_len(ex)) {
2263 *lblk = le32_to_cpu(ex->ee_block) + ext4_ext_get_actual_len(ex);
2431 struct ext4_extent *ex,
2436 unsigned short ee_len = ext4_ext_get_actual_len(ex);
2442 if (from < le32_to_cpu(ex->ee_block) ||
2443 to != le32_to_cpu(ex->ee_block) + ee_len - 1) {
2446 from, to, le32_to_cpu(ex->ee_block), ee_len);
2463 trace_ext4_remove_blocks(inode, ex, from, to, partial);
2469 last_pblk = ext4_ext_pblock(ex) + ee_len - 1;
2486 num = le32_to_cpu(ex->ee_block) + ee_len - from;
2487 pblk = ext4_ext_pblock(ex) + ee_len - num;
2580 struct ext4_extent *ex;
2593 ex = path[depth].p_ext;
2594 if (!ex)
2595 ex = EXT_LAST_EXTENT(eh);
2597 ex_ee_block = le32_to_cpu(ex->ee_block);
2598 ex_ee_len = ext4_ext_get_actual_len(ex);
2600 trace_ext4_ext_rm_leaf(inode, start, ex, partial);
2602 while (ex >= EXT_FIRST_EXTENT(eh) &&
2605 if (ext4_ext_is_unwritten(ex))
2612 path[depth].p_ext = ex;
2629 pblk = ext4_ext_pblock(ex);
2633 ex--;
2634 ex_ee_block = le32_to_cpu(ex->ee_block);
2635 ex_ee_len = ext4_ext_get_actual_len(ex);
2659 if (ex == EXT_FIRST_EXTENT(eh)) {
2686 err = ext4_remove_blocks(handle, inode, ex, partial, a, b);
2692 ext4_ext_store_pblock(ex, 0);
2694 ex->ee_len = cpu_to_le16(num);
2700 ext4_ext_mark_unwritten(ex);
2712 memmove(ex, ex+1, (EXT_LAST_EXTENT(eh) - ex) *
2727 ext4_ext_pblock(ex));
2728 ex--;
2729 ex_ee_block = le32_to_cpu(ex->ee_block);
2730 ex_ee_len = ext4_ext_get_actual_len(ex);
2743 if (partial->state == tofree && ex >= EXT_FIRST_EXTENT(eh)) {
2744 pblk = ext4_ext_pblock(ex) + ex_ee_len - 1;
2823 struct ext4_extent *ex;
2836 ex = path[depth].p_ext;
2837 if (!ex) {
2847 ee_block = le32_to_cpu(ex->ee_block);
2848 ex_end = ee_block + ext4_ext_get_actual_len(ex) - 1;
2864 pblk = ext4_ext_pblock(ex) + end - ee_block + 1;
3102 static void ext4_zeroout_es(struct inode *inode, struct ext4_extent *ex)
3108 ee_block = le32_to_cpu(ex->ee_block);
3109 ee_len = ext4_ext_get_actual_len(ex);
3110 ee_pblock = ext4_ext_pblock(ex);
3120 static int ext4_ext_zeroout(struct inode *inode, struct ext4_extent *ex)
3125 ee_len = ext4_ext_get_actual_len(ex);
3126 ee_pblock = ext4_ext_pblock(ex);
3127 return ext4_issue_zeroout(inode, le32_to_cpu(ex->ee_block), ee_pblock,
3162 struct ext4_extent *ex, newex, orig_ex, zero_ex;
3175 ex = path[depth].p_ext;
3176 ee_block = le32_to_cpu(ex->ee_block);
3177 ee_len = ext4_ext_get_actual_len(ex);
3178 newblock = split - ee_block + ext4_ext_pblock(ex);
3181 BUG_ON(!ext4_ext_is_unwritten(ex) &&
3197 ext4_ext_mark_unwritten(ex);
3199 ext4_ext_mark_initialized(ex);
3202 ext4_ext_try_to_merge(handle, inode, path, ex);
3209 memcpy(&orig_ex, ex, sizeof(orig_ex));
3210 ex->ee_len = cpu_to_le16(split - ee_block);
3212 ext4_ext_mark_unwritten(ex);
3243 err = ext4_ext_zeroout(inode, ex);
3244 zero_ex.ee_block = ex->ee_block;
3246 ext4_ext_get_actual_len(ex));
3248 ext4_ext_pblock(ex));
3261 ex->ee_len = cpu_to_le16(ee_len);
3262 ext4_ext_try_to_merge(handle, inode, path, ex);
3277 ex->ee_len = orig_ex.ee_len;
3309 struct ext4_extent *ex;
3317 ex = path[depth].p_ext;
3318 ee_block = le32_to_cpu(ex->ee_block);
3319 ee_len = ext4_ext_get_actual_len(ex);
3320 unwritten = ext4_ext_is_unwritten(ex);
3345 ex = path[depth].p_ext;
3346 if (!ex) {
3351 unwritten = ext4_ext_is_unwritten(ex);
3402 struct ext4_extent *ex, *abut_ex;
3420 ex = path[depth].p_ext;
3421 ee_block = le32_to_cpu(ex->ee_block);
3422 ee_len = ext4_ext_get_actual_len(ex);
3426 trace_ext4_ext_convert_to_initialized_enter(inode, map, ex);
3429 BUG_ON(!ext4_ext_is_unwritten(ex));
3450 (ex > EXT_FIRST_EXTENT(eh))) { /*L2*/
3455 abut_ex = ex - 1;
3459 ee_pblk = ext4_ext_pblock(ex);
3462 * A transfer of blocks from 'ex' to 'abut_ex' is allowed
3465 * - C2: abut_ex is logically abutting ex,
3466 * - C3: abut_ex is physically abutting ex,
3479 map, ex, abut_ex);
3481 /* Shift the start of ex by 'map_len' blocks */
3482 ex->ee_block = cpu_to_le32(ee_block + map_len);
3483 ext4_ext_store_pblock(ex, ee_pblk + map_len);
3484 ex->ee_len = cpu_to_le16(ee_len - map_len);
3485 ext4_ext_mark_unwritten(ex); /* Restore the flag */
3495 ex < EXT_LAST_EXTENT(eh)) { /*L2*/
3501 abut_ex = ex + 1;
3505 ee_pblk = ext4_ext_pblock(ex);
3508 * A transfer of blocks from 'ex' to 'abut_ex' is allowed
3511 * - C2: abut_ex is logically abutting ex,
3512 * - C3: abut_ex is physically abutting ex,
3525 map, ex, abut_ex);
3530 ex->ee_len = cpu_to_le16(ee_len - map_len);
3531 ext4_ext_mark_unwritten(ex); /* Restore the flag */
3584 ext4_ext_pblock(ex) + split_map.m_lblk +
3595 zero_ex2.ee_block = ex->ee_block;
3599 ext4_ext_pblock(ex));
3658 struct ext4_extent *ex;
3674 ex = path[depth].p_ext;
3675 ee_block = le32_to_cpu(ex->ee_block);
3676 ee_len = ext4_ext_get_actual_len(ex);
3697 struct ext4_extent *ex;
3704 ex = path[depth].p_ext;
3705 ee_block = le32_to_cpu(ex->ee_block);
3706 ee_len = ext4_ext_get_actual_len(ex);
3732 ex = path[depth].p_ext;
3739 ext4_ext_mark_initialized(ex);
3744 ext4_ext_try_to_merge(handle, inode, path, ex);
3760 struct ext4_extent *ex;
3774 ex = path[depth].p_ext;
3775 ee_block = le32_to_cpu(ex->ee_block);
3776 ee_len = ext4_ext_get_actual_len(ex);
3790 ex = path[depth].p_ext;
3791 if (!ex) {
3802 ext4_ext_mark_unwritten(ex);
3807 ext4_ext_try_to_merge(handle, inode, path, ex);
3945 * @ex The extent structure which might contain an implied
3967 * |----- ex -----| |---- ex_right ----|
3982 struct ext4_extent *ex,
3989 ext4_lblk_t ee_block = le32_to_cpu(ex->ee_block);
3990 ext4_fsblk_t ee_start = ext4_ext_pblock(ex);
3991 unsigned short ee_len = ext4_ext_get_actual_len(ex);
4021 * block to the right of 'ex' but before the end of the cluster.
4024 * |----- ex -----| |---- ex_right ----|
4127 struct ext4_extent newex, *ex, ex2;
4163 ex = path[depth].p_ext;
4164 if (ex) {
4165 ext4_lblk_t ee_block = le32_to_cpu(ex->ee_block);
4166 ext4_fsblk_t ee_start = ext4_ext_pblock(ex);
4174 ee_len = ext4_ext_get_actual_len(ex);
4190 if ((!ext4_ext_is_unwritten(ex)) &&
4195 } else if (!ext4_ext_is_unwritten(ex)) {
4240 if (cluster_offset && ex &&
4241 get_implied_cluster_alloc(inode->i_sb, map, ex, path)) {
5879 struct ext4_extent *ex;
5885 ex = path[path->p_depth].p_ext;
5886 if (!ex) {
5891 if (le32_to_cpu(ex->ee_block) != start ||
5892 ext4_ext_get_actual_len(ex) != len) {
5905 ex = path[path->p_depth].p_ext;
5906 WARN_ON(le32_to_cpu(ex->ee_block) != start);
5907 if (ext4_ext_get_actual_len(ex) != len) {
5918 ex = path[path->p_depth].p_ext;
5922 ext4_ext_mark_unwritten(ex);
5924 ext4_ext_mark_initialized(ex);
5925 ext4_ext_store_pblock(ex, pblk);
5939 struct ext4_extent *ex;
5946 ex = path[path->p_depth].p_ext;
5947 if (!ex) {
5953 cur = le32_to_cpu(ex->ee_block) + ext4_ext_get_actual_len(ex);
5956 ext4_ext_try_to_merge(NULL, inode, path, ex);
5987 struct ext4_extent *ex;
5998 ex = path[path->p_depth].p_ext;
5999 if (!ex) {
6003 end = le32_to_cpu(ex->ee_block) + ext4_ext_get_actual_len(ex);
6039 ex = path[path->p_depth].p_ext;
6040 if (!ex) {
6044 cur = max(cur + 1, le32_to_cpu(ex->ee_block) +
6045 ext4_ext_get_actual_len(ex));
6080 struct ext4_extent *ex;
6093 ex = path[path->p_depth].p_ext;
6094 if (!ex) {
6098 end = le32_to_cpu(ex->ee_block) + ext4_ext_get_actual_len(ex);