For testing extent mapping code, we will need the extent dumping function. So copy that function over from the resize2fs version of the code. Signed-off-by: Jan Kara <jack@xxxxxxxx> --- lib/ext2fs/extent_map.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/ext2fs/extent_map.c b/lib/ext2fs/extent_map.c index a4e1df404dca..0f1acc78b67f 100644 --- a/lib/ext2fs/extent_map.c +++ b/lib/ext2fs/extent_map.c @@ -231,3 +231,20 @@ errcode_t ext2fs_iterate_extent(ext2_map_extent extent, __u64 *old_loc, *size = ent->size; return 0; } + +/* + * For debugging only + */ +void ext2fs_extent_dump(ext2_map_extent extent, FILE *out) +{ + __u64 i; + struct ext2_map_extent_entry *ent; + + fputs("# Extent dump:\n", out); + fprintf(out, "#\tNum=%llu, Size=%llu, Cursor=%llu, Sorted=%llu\n", + extent->num, extent->size, extent->cursor, extent->sorted); + for (i=0, ent=extent->list; i < extent->num; i++, ent++) { + fprintf(out, "#\t\t %llu -> %llu (%llu)\n", ent->old_loc, + ent->new_loc, ent->size); + } +} -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html