Lines Matching refs:ex

196 		struct ext4_extent *ex;
215 ex = path[depth].p_ext;
216 if (ex) {
217 ext4_fsblk_t ext_pblk = ext4_ext_pblock(ex);
218 ext4_lblk_t ext_block = le32_to_cpu(ex->ee_block);
242 struct ext4_extent *ex, int *err, unsigned int flags)
246 goal = ext4_ext_find_goal(inode, path, le32_to_cpu(ex->ee_block));
506 struct ext4_extent *ex = EXT_FIRST_EXTENT(eh);
510 for (i = le16_to_cpu(eh->eh_entries); i > 0; i--, ex++) {
512 ext4_lblk_t lblk = le32_to_cpu(ex->ee_block);
513 int len = ext4_ext_get_actual_len(ex);
519 if (ext4_ext_is_unwritten(ex))
522 ext4_ext_pblock(ex), status);
681 struct ext4_extent *ex;
688 ex = EXT_FIRST_EXTENT(eh);
692 for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ex++) {
693 ext_debug(inode, "%d:[%d]%d:%llu ", le32_to_cpu(ex->ee_block),
694 ext4_ext_is_unwritten(ex),
695 ext4_ext_get_actual_len(ex), ext4_ext_pblock(ex));
704 struct ext4_extent *ex;
719 ex = path[depth].p_ext;
720 while (ex <= EXT_MAX_EXTENT(path[depth].p_hdr)) {
722 le32_to_cpu(ex->ee_block),
723 ext4_ext_pblock(ex),
724 ext4_ext_is_unwritten(ex),
725 ext4_ext_get_actual_len(ex),
727 ex++;
855 struct ext4_extent *chex, *ex;
858 chex = ex = EXT_FIRST_EXTENT(eh);
859 for (k = 0; k < le16_to_cpu(eh->eh_entries); k++, ex++) {
860 BUG_ON(k && le32_to_cpu(ex->ee_block)
861 <= le32_to_cpu(ex[-1].ee_block));
862 if (block < le32_to_cpu(ex->ee_block))
864 chex = ex;
1161 struct ext4_extent *ex;
1162 ex = EXT_FIRST_EXTENT(neh);
1163 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));
1516 if (unlikely(*logical < (le32_to_cpu(ex->ee_block) + ee_len))) {
1519 *logical, le32_to_cpu(ex->ee_block), ee_len);
1523 *logical = le32_to_cpu(ex->ee_block) + ee_len - 1;
1524 *phys = ext4_ext_pblock(ex) + ee_len - 1;
1543 struct ext4_extent *ex;
1561 ex = path[depth].p_ext;
1562 ee_len = ext4_ext_get_actual_len(ex);
1563 if (*logical < le32_to_cpu(ex->ee_block)) {
1564 if (unlikely(EXT_FIRST_EXTENT(path[depth].p_hdr) != ex)) {
1566 "first_extent(path[%d].p_hdr) != ex",
1582 if (unlikely(*logical < (le32_to_cpu(ex->ee_block) + ee_len))) {
1585 *logical, le32_to_cpu(ex->ee_block), ee_len);
1589 if (ex != EXT_LAST_EXTENT(path[depth].p_hdr)) {
1591 ex++;
1624 ex = EXT_FIRST_EXTENT(eh);
1626 *logical = le32_to_cpu(ex->ee_block);
1627 *phys = ext4_ext_pblock(ex);
1629 *ret_ex = *ex;
1711 struct ext4_extent *ex;
1716 ex = path[depth].p_ext;
1718 if (unlikely(ex == NULL || eh == NULL)) {
1720 "ex %p == NULL or eh %p == NULL", ex, eh);
1729 if (ex != EXT_FIRST_EXTENT(eh)) {
1796 * This function tries to merge the "ex" extent to the next extent in the tree.
1798 * left, pass "ex - 1" as argument instead of "ex".
1799 * Returns 0 if the extents (ex and ex+1) were _not_ merged and returns
1804 struct ext4_extent *ex)
1814 while (ex < EXT_LAST_EXTENT(eh)) {
1815 if (!ext4_can_extents_be_merged(inode, ex, ex + 1))
1818 unwritten = ext4_ext_is_unwritten(ex);
1819 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex)
1820 + ext4_ext_get_actual_len(ex + 1));
1822 ext4_ext_mark_unwritten(ex);
1824 if (ex + 1 < EXT_LAST_EXTENT(eh)) {
1825 len = (EXT_LAST_EXTENT(eh) - ex - 1)
1827 memmove(ex + 1, ex + 2, len);
1886 * This function tries to merge the @ex extent to neighbours in the tree, then
1892 struct ext4_extent *ex)
1902 if (ex > EXT_FIRST_EXTENT(eh))
1903 merge_done = ext4_ext_try_to_merge_right(inode, path, ex - 1);
1906 (void) ext4_ext_try_to_merge_right(inode, path, ex);
1974 struct ext4_extent *ex, *fex;
1988 ex = path[depth].p_ext;
1996 if (ex && !(gb_flags & EXT4_GET_BLOCKS_PRE_IO)) {
2000 * right from ex, or from the left of ex. This is because
2005 if (ex < EXT_LAST_EXTENT(eh) &&
2006 (le32_to_cpu(ex->ee_block) +
2007 ext4_ext_get_actual_len(ex) <
2009 ex += 1;
2011 } else if ((ex > EXT_FIRST_EXTENT(eh)) &&
2014 le32_to_cpu(ex->ee_block)))
2015 ex -= 1;
2017 /* Try to append newex to the ex */
2018 if (ext4_can_extents_be_merged(inode, ex, newext)) {
2023 le32_to_cpu(ex->ee_block),
2024 ext4_ext_is_unwritten(ex),
2025 ext4_ext_get_actual_len(ex),
2026 ext4_ext_pblock(ex));
2031 unwritten = ext4_ext_is_unwritten(ex);
2032 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex)
2035 ext4_ext_mark_unwritten(ex);
2037 nearex = ex;
2042 /* Try to prepend newex to the ex */
2043 if (ext4_can_extents_be_merged(inode, newext, ex)) {
2049 le32_to_cpu(ex->ee_block),
2050 ext4_ext_is_unwritten(ex),
2051 ext4_ext_get_actual_len(ex),
2052 ext4_ext_pblock(ex));
2058 unwritten = ext4_ext_is_unwritten(ex);
2059 ex->ee_block = newext->ee_block;
2060 ext4_ext_store_pblock(ex, ext4_ext_pblock(newext));
2061 ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex)
2064 ext4_ext_mark_unwritten(ex);
2066 nearex = ex;
2253 struct ext4_extent *ex;
2256 ex = path[depth].p_ext;
2257 if (ex == NULL) {
2261 } else if (*lblk < le32_to_cpu(ex->ee_block)) {
2262 len = le32_to_cpu(ex->ee_block) - *lblk;
2263 } else if (*lblk >= le32_to_cpu(ex->ee_block)
2264 + ext4_ext_get_actual_len(ex)) {
2267 *lblk = le32_to_cpu(ex->ee_block) + ext4_ext_get_actual_len(ex);
2459 struct ext4_extent *ex,
2464 unsigned short ee_len = ext4_ext_get_actual_len(ex);
2470 if (from < le32_to_cpu(ex->ee_block) ||
2471 to != le32_to_cpu(ex->ee_block) + ee_len - 1) {
2474 from, to, le32_to_cpu(ex->ee_block), ee_len);
2491 trace_ext4_remove_blocks(inode, ex, from, to, partial);
2497 last_pblk = ext4_ext_pblock(ex) + ee_len - 1;
2514 num = le32_to_cpu(ex->ee_block) + ee_len - from;
2515 pblk = ext4_ext_pblock(ex) + ee_len - num;
2608 struct ext4_extent *ex;
2621 ex = path[depth].p_ext;
2622 if (!ex)
2623 ex = EXT_LAST_EXTENT(eh);
2625 ex_ee_block = le32_to_cpu(ex->ee_block);
2626 ex_ee_len = ext4_ext_get_actual_len(ex);
2628 trace_ext4_ext_rm_leaf(inode, start, ex, partial);
2630 while (ex >= EXT_FIRST_EXTENT(eh) &&
2633 if (ext4_ext_is_unwritten(ex))
2640 path[depth].p_ext = ex;
2658 pblk = ext4_ext_pblock(ex);
2662 ex--;
2663 ex_ee_block = le32_to_cpu(ex->ee_block);
2664 ex_ee_len = ext4_ext_get_actual_len(ex);
2688 if (ex == EXT_FIRST_EXTENT(eh)) {
2715 err = ext4_remove_blocks(handle, inode, ex, partial, a, b);
2721 ext4_ext_store_pblock(ex, 0);
2723 ex->ee_len = cpu_to_le16(num);
2729 ext4_ext_mark_unwritten(ex);
2741 memmove(ex, ex+1, (EXT_LAST_EXTENT(eh) - ex) *
2756 ext4_ext_pblock(ex));
2757 ex--;
2758 ex_ee_block = le32_to_cpu(ex->ee_block);
2759 ex_ee_len = ext4_ext_get_actual_len(ex);
2772 if (partial->state == tofree && ex >= EXT_FIRST_EXTENT(eh)) {
2773 pblk = ext4_ext_pblock(ex) + ex_ee_len - 1;
2852 struct ext4_extent *ex;
2865 ex = path[depth].p_ext;
2866 if (!ex) {
2876 ee_block = le32_to_cpu(ex->ee_block);
2877 ex_end = ee_block + ext4_ext_get_actual_len(ex) - 1;
2893 pblk = ext4_ext_pblock(ex) + end - ee_block + 1;
3132 static int ext4_zeroout_es(struct inode *inode, struct ext4_extent *ex)
3138 ee_block = le32_to_cpu(ex->ee_block);
3139 ee_len = ext4_ext_get_actual_len(ex);
3140 ee_pblock = ext4_ext_pblock(ex);
3150 static int ext4_ext_zeroout(struct inode *inode, struct ext4_extent *ex)
3155 ee_len = ext4_ext_get_actual_len(ex);
3156 ee_pblock = ext4_ext_pblock(ex);
3157 return ext4_issue_zeroout(inode, le32_to_cpu(ex->ee_block), ee_pblock,
3192 struct ext4_extent *ex, newex, orig_ex, zero_ex;
3205 ex = path[depth].p_ext;
3206 ee_block = le32_to_cpu(ex->ee_block);
3207 ee_len = ext4_ext_get_actual_len(ex);
3208 newblock = split - ee_block + ext4_ext_pblock(ex);
3211 BUG_ON(!ext4_ext_is_unwritten(ex) &&
3227 ext4_ext_mark_unwritten(ex);
3229 ext4_ext_mark_initialized(ex);
3232 ext4_ext_try_to_merge(handle, inode, path, ex);
3239 memcpy(&orig_ex, ex, sizeof(orig_ex));
3240 ex->ee_len = cpu_to_le16(split - ee_block);
3242 ext4_ext_mark_unwritten(ex);
3273 err = ext4_ext_zeroout(inode, ex);
3274 zero_ex.ee_block = ex->ee_block;
3276 ext4_ext_get_actual_len(ex));
3278 ext4_ext_pblock(ex));
3291 ex->ee_len = cpu_to_le16(ee_len);
3292 ext4_ext_try_to_merge(handle, inode, path, ex);
3307 ex->ee_len = orig_ex.ee_len;
3339 struct ext4_extent *ex;
3347 ex = path[depth].p_ext;
3348 ee_block = le32_to_cpu(ex->ee_block);
3349 ee_len = ext4_ext_get_actual_len(ex);
3350 unwritten = ext4_ext_is_unwritten(ex);
3375 ex = path[depth].p_ext;
3376 if (!ex) {
3381 unwritten = ext4_ext_is_unwritten(ex);
3433 struct ext4_extent *ex, *abut_ex;
3451 ex = path[depth].p_ext;
3452 ee_block = le32_to_cpu(ex->ee_block);
3453 ee_len = ext4_ext_get_actual_len(ex);
3457 trace_ext4_ext_convert_to_initialized_enter(inode, map, ex);
3460 BUG_ON(!ext4_ext_is_unwritten(ex));
3481 (ex > EXT_FIRST_EXTENT(eh))) { /*L2*/
3486 abut_ex = ex - 1;
3490 ee_pblk = ext4_ext_pblock(ex);
3493 * A transfer of blocks from 'ex' to 'abut_ex' is allowed
3496 * - C2: abut_ex is logically abutting ex,
3497 * - C3: abut_ex is physically abutting ex,
3510 map, ex, abut_ex);
3512 /* Shift the start of ex by 'map_len' blocks */
3513 ex->ee_block = cpu_to_le32(ee_block + map_len);
3514 ext4_ext_store_pblock(ex, ee_pblk + map_len);
3515 ex->ee_len = cpu_to_le16(ee_len - map_len);
3516 ext4_ext_mark_unwritten(ex); /* Restore the flag */
3526 ex < EXT_LAST_EXTENT(eh)) { /*L2*/
3532 abut_ex = ex + 1;
3536 ee_pblk = ext4_ext_pblock(ex);
3539 * A transfer of blocks from 'ex' to 'abut_ex' is allowed
3542 * - C2: abut_ex is logically abutting ex,
3543 * - C3: abut_ex is physically abutting ex,
3556 map, ex, abut_ex);
3561 ex->ee_len = cpu_to_le16(ee_len - map_len);
3562 ext4_ext_mark_unwritten(ex); /* Restore the flag */
3615 ext4_ext_pblock(ex) + split_map.m_lblk +
3626 zero_ex2.ee_block = ex->ee_block;
3630 ext4_ext_pblock(ex));
3690 struct ext4_extent *ex;
3706 ex = path[depth].p_ext;
3707 ee_block = le32_to_cpu(ex->ee_block);
3708 ee_len = ext4_ext_get_actual_len(ex);
3729 struct ext4_extent *ex;
3736 ex = path[depth].p_ext;
3737 ee_block = le32_to_cpu(ex->ee_block);
3738 ee_len = ext4_ext_get_actual_len(ex);
3764 ex = path[depth].p_ext;
3771 ext4_ext_mark_initialized(ex);
3776 ext4_ext_try_to_merge(handle, inode, path, ex);
3792 struct ext4_extent *ex;
3806 ex = path[depth].p_ext;
3807 ee_block = le32_to_cpu(ex->ee_block);
3808 ee_len = ext4_ext_get_actual_len(ex);
3822 ex = path[depth].p_ext;
3823 if (!ex) {
3834 ext4_ext_mark_unwritten(ex);
3839 ext4_ext_try_to_merge(handle, inode, path, ex);
3977 * @ex The extent structure which might contain an implied
3999 * |----- ex -----| |---- ex_right ----|
4014 struct ext4_extent *ex,
4021 ext4_lblk_t ee_block = le32_to_cpu(ex->ee_block);
4022 ext4_fsblk_t ee_start = ext4_ext_pblock(ex);
4023 unsigned short ee_len = ext4_ext_get_actual_len(ex);
4053 * block to the right of 'ex' but before the end of the cluster.
4056 * |----- ex -----| |---- ex_right ----|
4096 struct ext4_extent newex, *ex, ex2;
4132 ex = path[depth].p_ext;
4133 if (ex) {
4134 ext4_lblk_t ee_block = le32_to_cpu(ex->ee_block);
4135 ext4_fsblk_t ee_start = ext4_ext_pblock(ex);
4143 ee_len = ext4_ext_get_actual_len(ex);
4159 if ((!ext4_ext_is_unwritten(ex)) &&
4164 } else if (!ext4_ext_is_unwritten(ex)) {
4219 if (cluster_offset && ex &&
4220 get_implied_cluster_alloc(inode->i_sb, map, ex, path)) {
5894 struct ext4_extent *ex;
5900 ex = path[path->p_depth].p_ext;
5901 if (!ex) {
5906 if (le32_to_cpu(ex->ee_block) != start ||
5907 ext4_ext_get_actual_len(ex) != len) {
5920 ex = path[path->p_depth].p_ext;
5921 WARN_ON(le32_to_cpu(ex->ee_block) != start);
5922 if (ext4_ext_get_actual_len(ex) != len) {
5933 ex = path[path->p_depth].p_ext;
5937 ext4_ext_mark_unwritten(ex);
5939 ext4_ext_mark_initialized(ex);
5940 ext4_ext_store_pblock(ex, pblk);
5955 struct ext4_extent *ex;
5962 ex = path[path->p_depth].p_ext;
5963 if (!ex) {
5970 cur = le32_to_cpu(ex->ee_block) + ext4_ext_get_actual_len(ex);
5973 ext4_ext_try_to_merge(NULL, inode, path, ex);
6005 struct ext4_extent *ex;
6016 ex = path[path->p_depth].p_ext;
6017 if (!ex) {
6022 end = le32_to_cpu(ex->ee_block) + ext4_ext_get_actual_len(ex);
6060 ex = path[path->p_depth].p_ext;
6061 if (!ex) {
6066 cur = max(cur + 1, le32_to_cpu(ex->ee_block) +
6067 ext4_ext_get_actual_len(ex));
6080 ex = path2[path2->p_depth].p_ext;
6107 struct ext4_extent *ex;
6117 ex = path[path->p_depth].p_ext;
6118 if (!ex) {
6123 end = le32_to_cpu(ex->ee_block) + ext4_ext_get_actual_len(ex);