diff options
author | Mingming <cmm@us.ibm.com> | 2009-09-18 13:34:55 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-09-18 13:34:55 -0400 |
commit | 553f9008939638335836eec834f4dea310c17eae (patch) | |
tree | 1d1ea9defa550d522b68bb12dab7f0e139aa205a /fs | |
parent | 84fe3bef59dc45a1cb0d2f9b0aefa8f1fbfbdf98 (diff) |
ext4: Show unwritten extent flag in ext4_ext_show_leaf()
ext4_ext_show_leaf() will display the leaf extents when extent
debugging is enabled.
Printing out the unwritten bit is useful for debugging unwritten
extent, allow us to see the unwritten extents vs written extents,
after the unwritten extents are splitted or converted.
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/ext4_extents.h | 3 | ||||
-rw-r--r-- | fs/ext4/extents.c | 31 |
2 files changed, 23 insertions, 11 deletions
diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h index 20a84105a10b..9538633879d7 100644 --- a/fs/ext4/ext4_extents.h +++ b/fs/ext4/ext4_extents.h | |||
@@ -43,8 +43,7 @@ | |||
43 | #define CHECK_BINSEARCH__ | 43 | #define CHECK_BINSEARCH__ |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * If EXT_DEBUG is defined you can use the 'extdebug' mount option | 46 | * Turn on EXT_DEBUG to get lots of info about extents operations. |
47 | * to get lots of info about what's going on. | ||
48 | */ | 47 | */ |
49 | #define EXT_DEBUG__ | 48 | #define EXT_DEBUG__ |
50 | #ifdef EXT_DEBUG | 49 | #ifdef EXT_DEBUG |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index c583ebd1e41f..13db43408533 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -437,8 +437,9 @@ static void ext4_ext_show_path(struct inode *inode, struct ext4_ext_path *path) | |||
437 | ext_debug(" %d->%llu", le32_to_cpu(path->p_idx->ei_block), | 437 | ext_debug(" %d->%llu", le32_to_cpu(path->p_idx->ei_block), |
438 | idx_pblock(path->p_idx)); | 438 | idx_pblock(path->p_idx)); |
439 | } else if (path->p_ext) { | 439 | } else if (path->p_ext) { |
440 | ext_debug(" %d:%d:%llu ", | 440 | ext_debug(" %d:[%d]%d:%llu ", |
441 | le32_to_cpu(path->p_ext->ee_block), | 441 | le32_to_cpu(path->p_ext->ee_block), |
442 | ext4_ext_is_uninitialized(path->p_ext), | ||
442 | ext4_ext_get_actual_len(path->p_ext), | 443 | ext4_ext_get_actual_len(path->p_ext), |
443 | ext_pblock(path->p_ext)); | 444 | ext_pblock(path->p_ext)); |
444 | } else | 445 | } else |
@@ -460,8 +461,11 @@ static void ext4_ext_show_leaf(struct inode *inode, struct ext4_ext_path *path) | |||
460 | eh = path[depth].p_hdr; | 461 | eh = path[depth].p_hdr; |
461 | ex = EXT_FIRST_EXTENT(eh); | 462 | ex = EXT_FIRST_EXTENT(eh); |
462 | 463 | ||
464 | ext_debug("Displaying leaf extents for inode %lu\n", inode->i_ino); | ||
465 | |||
463 | for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ex++) { | 466 | for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ex++) { |
464 | ext_debug("%d:%d:%llu ", le32_to_cpu(ex->ee_block), | 467 | ext_debug("%d:[%d]%d:%llu ", le32_to_cpu(ex->ee_block), |
468 | ext4_ext_is_uninitialized(ex), | ||
465 | ext4_ext_get_actual_len(ex), ext_pblock(ex)); | 469 | ext4_ext_get_actual_len(ex), ext_pblock(ex)); |
466 | } | 470 | } |
467 | ext_debug("\n"); | 471 | ext_debug("\n"); |
@@ -580,9 +584,10 @@ ext4_ext_binsearch(struct inode *inode, | |||
580 | } | 584 | } |
581 | 585 | ||
582 | path->p_ext = l - 1; | 586 | path->p_ext = l - 1; |
583 | ext_debug(" -> %d:%llu:%d ", | 587 | ext_debug(" -> %d:%llu:[%d]%d ", |
584 | le32_to_cpu(path->p_ext->ee_block), | 588 | le32_to_cpu(path->p_ext->ee_block), |
585 | ext_pblock(path->p_ext), | 589 | ext_pblock(path->p_ext), |
590 | ext4_ext_is_uninitialized(path->p_ext), | ||
586 | ext4_ext_get_actual_len(path->p_ext)); | 591 | ext4_ext_get_actual_len(path->p_ext)); |
587 | 592 | ||
588 | #ifdef CHECK_BINSEARCH | 593 | #ifdef CHECK_BINSEARCH |
@@ -850,9 +855,10 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode, | |||
850 | path[depth].p_ext++; | 855 | path[depth].p_ext++; |
851 | while (path[depth].p_ext <= | 856 | while (path[depth].p_ext <= |
852 | EXT_MAX_EXTENT(path[depth].p_hdr)) { | 857 | EXT_MAX_EXTENT(path[depth].p_hdr)) { |
853 | ext_debug("move %d:%llu:%d in new leaf %llu\n", | 858 | ext_debug("move %d:%llu:[%d]%d in new leaf %llu\n", |
854 | le32_to_cpu(path[depth].p_ext->ee_block), | 859 | le32_to_cpu(path[depth].p_ext->ee_block), |
855 | ext_pblock(path[depth].p_ext), | 860 | ext_pblock(path[depth].p_ext), |
861 | ext4_ext_is_uninitialized(path[depth].p_ext), | ||
856 | ext4_ext_get_actual_len(path[depth].p_ext), | 862 | ext4_ext_get_actual_len(path[depth].p_ext), |
857 | newblock); | 863 | newblock); |
858 | /*memmove(ex++, path[depth].p_ext++, | 864 | /*memmove(ex++, path[depth].p_ext++, |
@@ -1580,9 +1586,11 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode, | |||
1580 | 1586 | ||
1581 | /* try to insert block into found extent and return */ | 1587 | /* try to insert block into found extent and return */ |
1582 | if (ex && ext4_can_extents_be_merged(inode, ex, newext)) { | 1588 | if (ex && ext4_can_extents_be_merged(inode, ex, newext)) { |
1583 | ext_debug("append %d block to %d:%d (from %llu)\n", | 1589 | ext_debug("append [%d]%d block to %d:[%d]%d (from %llu)\n", |
1590 | ext4_ext_is_uninitialized(newext), | ||
1584 | ext4_ext_get_actual_len(newext), | 1591 | ext4_ext_get_actual_len(newext), |
1585 | le32_to_cpu(ex->ee_block), | 1592 | le32_to_cpu(ex->ee_block), |
1593 | ext4_ext_is_uninitialized(ex), | ||
1586 | ext4_ext_get_actual_len(ex), ext_pblock(ex)); | 1594 | ext4_ext_get_actual_len(ex), ext_pblock(ex)); |
1587 | err = ext4_ext_get_access(handle, inode, path + depth); | 1595 | err = ext4_ext_get_access(handle, inode, path + depth); |
1588 | if (err) | 1596 | if (err) |
@@ -1651,9 +1659,10 @@ has_space: | |||
1651 | 1659 | ||
1652 | if (!nearex) { | 1660 | if (!nearex) { |
1653 | /* there is no extent in this leaf, create first one */ | 1661 | /* there is no extent in this leaf, create first one */ |
1654 | ext_debug("first extent in the leaf: %d:%llu:%d\n", | 1662 | ext_debug("first extent in the leaf: %d:%llu:[%d]%d\n", |
1655 | le32_to_cpu(newext->ee_block), | 1663 | le32_to_cpu(newext->ee_block), |
1656 | ext_pblock(newext), | 1664 | ext_pblock(newext), |
1665 | ext4_ext_is_uninitialized(newext), | ||
1657 | ext4_ext_get_actual_len(newext)); | 1666 | ext4_ext_get_actual_len(newext)); |
1658 | path[depth].p_ext = EXT_FIRST_EXTENT(eh); | 1667 | path[depth].p_ext = EXT_FIRST_EXTENT(eh); |
1659 | } else if (le32_to_cpu(newext->ee_block) | 1668 | } else if (le32_to_cpu(newext->ee_block) |
@@ -1663,10 +1672,11 @@ has_space: | |||
1663 | len = EXT_MAX_EXTENT(eh) - nearex; | 1672 | len = EXT_MAX_EXTENT(eh) - nearex; |
1664 | len = (len - 1) * sizeof(struct ext4_extent); | 1673 | len = (len - 1) * sizeof(struct ext4_extent); |
1665 | len = len < 0 ? 0 : len; | 1674 | len = len < 0 ? 0 : len; |
1666 | ext_debug("insert %d:%llu:%d after: nearest 0x%p, " | 1675 | ext_debug("insert %d:%llu:[%d]%d after: nearest 0x%p, " |
1667 | "move %d from 0x%p to 0x%p\n", | 1676 | "move %d from 0x%p to 0x%p\n", |
1668 | le32_to_cpu(newext->ee_block), | 1677 | le32_to_cpu(newext->ee_block), |
1669 | ext_pblock(newext), | 1678 | ext_pblock(newext), |
1679 | ext4_ext_is_uninitialized(newext), | ||
1670 | ext4_ext_get_actual_len(newext), | 1680 | ext4_ext_get_actual_len(newext), |
1671 | nearex, len, nearex + 1, nearex + 2); | 1681 | nearex, len, nearex + 1, nearex + 2); |
1672 | memmove(nearex + 2, nearex + 1, len); | 1682 | memmove(nearex + 2, nearex + 1, len); |
@@ -1676,10 +1686,11 @@ has_space: | |||
1676 | BUG_ON(newext->ee_block == nearex->ee_block); | 1686 | BUG_ON(newext->ee_block == nearex->ee_block); |
1677 | len = (EXT_MAX_EXTENT(eh) - nearex) * sizeof(struct ext4_extent); | 1687 | len = (EXT_MAX_EXTENT(eh) - nearex) * sizeof(struct ext4_extent); |
1678 | len = len < 0 ? 0 : len; | 1688 | len = len < 0 ? 0 : len; |
1679 | ext_debug("insert %d:%llu:%d before: nearest 0x%p, " | 1689 | ext_debug("insert %d:%llu:[%d]%d before: nearest 0x%p, " |
1680 | "move %d from 0x%p to 0x%p\n", | 1690 | "move %d from 0x%p to 0x%p\n", |
1681 | le32_to_cpu(newext->ee_block), | 1691 | le32_to_cpu(newext->ee_block), |
1682 | ext_pblock(newext), | 1692 | ext_pblock(newext), |
1693 | ext4_ext_is_uninitialized(newext), | ||
1683 | ext4_ext_get_actual_len(newext), | 1694 | ext4_ext_get_actual_len(newext), |
1684 | nearex, len, nearex + 1, nearex + 2); | 1695 | nearex, len, nearex + 1, nearex + 2); |
1685 | memmove(nearex + 1, nearex, len); | 1696 | memmove(nearex + 1, nearex, len); |
@@ -2094,7 +2105,8 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, | |||
2094 | else | 2105 | else |
2095 | uninitialized = 0; | 2106 | uninitialized = 0; |
2096 | 2107 | ||
2097 | ext_debug("remove ext %u:%d\n", ex_ee_block, ex_ee_len); | 2108 | ext_debug("remove ext %u:[%d]%d\n", ex_ee_block, |
2109 | uninitialized, ex_ee_len); | ||
2098 | path[depth].p_ext = ex; | 2110 | path[depth].p_ext = ex; |
2099 | 2111 | ||
2100 | a = ex_ee_block > start ? ex_ee_block : start; | 2112 | a = ex_ee_block > start ? ex_ee_block : start; |
@@ -2743,6 +2755,7 @@ insert: | |||
2743 | } else if (err) | 2755 | } else if (err) |
2744 | goto fix_extent_len; | 2756 | goto fix_extent_len; |
2745 | out: | 2757 | out: |
2758 | ext4_ext_show_leaf(inode, path); | ||
2746 | return err ? err : allocated; | 2759 | return err ? err : allocated; |
2747 | 2760 | ||
2748 | fix_extent_len: | 2761 | fix_extent_len: |