zram could be provided as a module. Then, debuginfo for zram-related
data structures are not contained in vmlinux, which needs to be loaded
after debuginfo for zram module is loaded. This patch makes
try_zram_decompress() tries to load debuginfo for zram.
---
diskdump.c | 12 ++++++++++++
memory.c | 4 ----
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/diskdump.c b/diskdump.c
index 40d3eb7..65f43ff 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -2586,6 +2586,15 @@ diskdump_device_dump_info(FILE *ofp)
}
#ifdef LZO
+static void
+zram_init(void)
+{
+ MEMBER_OFFSET_INIT(zram_mempoll, "zram", "mem_pool");
+ MEMBER_OFFSET_INIT(zram_compressor, "zram", "compressor");
+ MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "flags");
+ STRUCT_SIZE_INIT(zram_table_entry, "zram_table_entry");
+}
+
static unsigned char *
zram_object_addr(ulong pool, ulong handle, unsigned char *zram_buf)
{
@@ -2708,6 +2717,9 @@ try_zram_decompress(ulonglong pte_val, unsigned char *buf, ulong
len, ulonglong
unsigned char *zram_buf = NULL;
unsigned char *outbuf = NULL;
+ if (INVALID_MEMBER(zram_compressor))
+ zram_init();
+
off = PAGEOFFSET(vaddr);
if (!symbol_exists("swap_info"))
return 0;
diff --git a/memory.c b/memory.c
index 2d9b50a..2bea128 100644
--- a/memory.c
+++ b/memory.c
@@ -487,10 +487,6 @@ vm_init(void)
"swap_info_struct", "old_block_size");
MEMBER_OFFSET_INIT(swap_info_struct_bdev, "swap_info_struct",
"bdev");
- MEMBER_OFFSET_INIT(zram_mempoll, "zram", "mem_pool");
- MEMBER_OFFSET_INIT(zram_compressor, "zram", "compressor");
- MEMBER_OFFSET_INIT(zram_table_flag, "zram_table_entry", "flags");
- STRUCT_SIZE_INIT(zram_table_entry, "zram_table_entry");
MEMBER_OFFSET_INIT(zspoll_size_class, "zs_pool", "size_class");
MEMBER_OFFSET_INIT(size_class_size, "size_class", "size");
--
1.8.3.1