[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1438944689-24562-17-git-send-email-jack@suse.com>
Date: Fri, 7 Aug 2015 12:51:26 +0200
From: Jan Kara <jack@...e.com>
To: linux-ext4@...r.kernel.org
Cc: Ted Tso <tytso@....edu>,
"Darrick J. Wong" <darrick.wong@...cle.com>,
Jan Kara <jack@...e.com>
Subject: [PATCH 16/19] ext2fs: Add extent dumping function to extent mapping code
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@...e.com>
---
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 702172b24e2b..251212d118cb 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists