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>
This commit is contained in:
Mingming 2009-09-18 13:34:55 -04:00 committed by Theodore Ts'o
parent 84fe3bef59
commit 553f900893
2 changed files with 23 additions and 11 deletions

View file

@ -43,8 +43,7 @@
#define CHECK_BINSEARCH__ #define CHECK_BINSEARCH__
/* /*
* If EXT_DEBUG is defined you can use the 'extdebug' mount option * Turn on EXT_DEBUG to get lots of info about extents operations.
* to get lots of info about what's going on.
*/ */
#define EXT_DEBUG__ #define EXT_DEBUG__
#ifdef EXT_DEBUG #ifdef EXT_DEBUG

View file

@ -437,8 +437,9 @@ static void ext4_ext_show_path(struct inode *inode, struct ext4_ext_path *path)
ext_debug(" %d->%llu", le32_to_cpu(path->p_idx->ei_block), ext_debug(" %d->%llu", le32_to_cpu(path->p_idx->ei_block),
idx_pblock(path->p_idx)); idx_pblock(path->p_idx));
} else if (path->p_ext) { } else if (path->p_ext) {
ext_debug(" %d:%d:%llu ", ext_debug(" %d:[%d]%d:%llu ",
le32_to_cpu(path->p_ext->ee_block), le32_to_cpu(path->p_ext->ee_block),
ext4_ext_is_uninitialized(path->p_ext),
ext4_ext_get_actual_len(path->p_ext), ext4_ext_get_actual_len(path->p_ext),
ext_pblock(path->p_ext)); ext_pblock(path->p_ext));
} else } else
@ -460,8 +461,11 @@ static void ext4_ext_show_leaf(struct inode *inode, struct ext4_ext_path *path)
eh = path[depth].p_hdr; eh = path[depth].p_hdr;
ex = EXT_FIRST_EXTENT(eh); ex = EXT_FIRST_EXTENT(eh);
ext_debug("Displaying leaf extents for inode %lu\n", inode->i_ino);
for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ex++) { for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ex++) {
ext_debug("%d:%d:%llu ", le32_to_cpu(ex->ee_block), ext_debug("%d:[%d]%d:%llu ", le32_to_cpu(ex->ee_block),
ext4_ext_is_uninitialized(ex),
ext4_ext_get_actual_len(ex), ext_pblock(ex)); ext4_ext_get_actual_len(ex), ext_pblock(ex));
} }
ext_debug("\n"); ext_debug("\n");
@ -580,9 +584,10 @@ ext4_ext_binsearch(struct inode *inode,
} }
path->p_ext = l - 1; path->p_ext = l - 1;
ext_debug(" -> %d:%llu:%d ", ext_debug(" -> %d:%llu:[%d]%d ",
le32_to_cpu(path->p_ext->ee_block), le32_to_cpu(path->p_ext->ee_block),
ext_pblock(path->p_ext), ext_pblock(path->p_ext),
ext4_ext_is_uninitialized(path->p_ext),
ext4_ext_get_actual_len(path->p_ext)); ext4_ext_get_actual_len(path->p_ext));
#ifdef CHECK_BINSEARCH #ifdef CHECK_BINSEARCH
@ -850,9 +855,10 @@ static int ext4_ext_split(handle_t *handle, struct inode *inode,
path[depth].p_ext++; path[depth].p_ext++;
while (path[depth].p_ext <= while (path[depth].p_ext <=
EXT_MAX_EXTENT(path[depth].p_hdr)) { EXT_MAX_EXTENT(path[depth].p_hdr)) {
ext_debug("move %d:%llu:%d in new leaf %llu\n", ext_debug("move %d:%llu:[%d]%d in new leaf %llu\n",
le32_to_cpu(path[depth].p_ext->ee_block), le32_to_cpu(path[depth].p_ext->ee_block),
ext_pblock(path[depth].p_ext), ext_pblock(path[depth].p_ext),
ext4_ext_is_uninitialized(path[depth].p_ext),
ext4_ext_get_actual_len(path[depth].p_ext), ext4_ext_get_actual_len(path[depth].p_ext),
newblock); newblock);
/*memmove(ex++, path[depth].p_ext++, /*memmove(ex++, path[depth].p_ext++,
@ -1580,9 +1586,11 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
/* try to insert block into found extent and return */ /* try to insert block into found extent and return */
if (ex && ext4_can_extents_be_merged(inode, ex, newext)) { if (ex && ext4_can_extents_be_merged(inode, ex, newext)) {
ext_debug("append %d block to %d:%d (from %llu)\n", ext_debug("append [%d]%d block to %d:[%d]%d (from %llu)\n",
ext4_ext_is_uninitialized(newext),
ext4_ext_get_actual_len(newext), ext4_ext_get_actual_len(newext),
le32_to_cpu(ex->ee_block), le32_to_cpu(ex->ee_block),
ext4_ext_is_uninitialized(ex),
ext4_ext_get_actual_len(ex), ext_pblock(ex)); ext4_ext_get_actual_len(ex), ext_pblock(ex));
err = ext4_ext_get_access(handle, inode, path + depth); err = ext4_ext_get_access(handle, inode, path + depth);
if (err) if (err)
@ -1651,9 +1659,10 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
if (!nearex) { if (!nearex) {
/* there is no extent in this leaf, create first one */ /* there is no extent in this leaf, create first one */
ext_debug("first extent in the leaf: %d:%llu:%d\n", ext_debug("first extent in the leaf: %d:%llu:[%d]%d\n",
le32_to_cpu(newext->ee_block), le32_to_cpu(newext->ee_block),
ext_pblock(newext), ext_pblock(newext),
ext4_ext_is_uninitialized(newext),
ext4_ext_get_actual_len(newext)); ext4_ext_get_actual_len(newext));
path[depth].p_ext = EXT_FIRST_EXTENT(eh); path[depth].p_ext = EXT_FIRST_EXTENT(eh);
} else if (le32_to_cpu(newext->ee_block) } else if (le32_to_cpu(newext->ee_block)
@ -1663,10 +1672,11 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
len = EXT_MAX_EXTENT(eh) - nearex; len = EXT_MAX_EXTENT(eh) - nearex;
len = (len - 1) * sizeof(struct ext4_extent); len = (len - 1) * sizeof(struct ext4_extent);
len = len < 0 ? 0 : len; len = len < 0 ? 0 : len;
ext_debug("insert %d:%llu:%d after: nearest 0x%p, " ext_debug("insert %d:%llu:[%d]%d after: nearest 0x%p, "
"move %d from 0x%p to 0x%p\n", "move %d from 0x%p to 0x%p\n",
le32_to_cpu(newext->ee_block), le32_to_cpu(newext->ee_block),
ext_pblock(newext), ext_pblock(newext),
ext4_ext_is_uninitialized(newext),
ext4_ext_get_actual_len(newext), ext4_ext_get_actual_len(newext),
nearex, len, nearex + 1, nearex + 2); nearex, len, nearex + 1, nearex + 2);
memmove(nearex + 2, nearex + 1, len); memmove(nearex + 2, nearex + 1, len);
@ -1676,10 +1686,11 @@ int ext4_ext_insert_extent(handle_t *handle, struct inode *inode,
BUG_ON(newext->ee_block == nearex->ee_block); BUG_ON(newext->ee_block == nearex->ee_block);
len = (EXT_MAX_EXTENT(eh) - nearex) * sizeof(struct ext4_extent); len = (EXT_MAX_EXTENT(eh) - nearex) * sizeof(struct ext4_extent);
len = len < 0 ? 0 : len; len = len < 0 ? 0 : len;
ext_debug("insert %d:%llu:%d before: nearest 0x%p, " ext_debug("insert %d:%llu:[%d]%d before: nearest 0x%p, "
"move %d from 0x%p to 0x%p\n", "move %d from 0x%p to 0x%p\n",
le32_to_cpu(newext->ee_block), le32_to_cpu(newext->ee_block),
ext_pblock(newext), ext_pblock(newext),
ext4_ext_is_uninitialized(newext),
ext4_ext_get_actual_len(newext), ext4_ext_get_actual_len(newext),
nearex, len, nearex + 1, nearex + 2); nearex, len, nearex + 1, nearex + 2);
memmove(nearex + 1, nearex, len); memmove(nearex + 1, nearex, len);
@ -2094,7 +2105,8 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
else else
uninitialized = 0; uninitialized = 0;
ext_debug("remove ext %u:%d\n", ex_ee_block, ex_ee_len); ext_debug("remove ext %u:[%d]%d\n", ex_ee_block,
uninitialized, ex_ee_len);
path[depth].p_ext = ex; path[depth].p_ext = ex;
a = ex_ee_block > start ? ex_ee_block : start; a = ex_ee_block > start ? ex_ee_block : start;
@ -2743,6 +2755,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
} else if (err) } else if (err)
goto fix_extent_len; goto fix_extent_len;
out: out:
ext4_ext_show_leaf(inode, path);
return err ? err : allocated; return err ? err : allocated;
fix_extent_len: fix_extent_len: