FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Crash Utility

 
 
LinkBack Thread Tools
 
Old 07-03-2012, 03:09 AM
HATAYAMA Daisuke
 
Default crash: Add Snappy Compression Support

This patch series add snappy compression support for crash utility,
applied on top of v6.0.8.

snappy is fast compressoin algorhythm like lzo, but it's more
optimized than lzo on x86 machines and some other archs.

A lot of benchmark is available on the web. Here I only point at my
benchmark I posted a few weeks ago,

- http://lists.infradead.org/pipermail/kexec/2012-June/006425.html

where snappy shows mostly as good performance as simple copying on
the worst case that input data increases its data size during
compression; this means we can use snappy with mostly NO risk.

How to get snappy libraries:

1) Use yum framework to get snappy and snappy-devel packages, or

2) Visit official website: http://code.google.com/p/snappy/,
download snappy-<version>.tar.gz and then build it.

How to build crash utility with snappy support:

1) Put -DSNAPPY in CFLAGS.extra file and put -lsnappy in
LDFRAGS.extra file.

2) Do make as always.

---

HATAYAMA Daisuke (3):
Add uncompression processing
Add snappy supporting flag
Add dump header for snappy


defs.h | 4 ++++
diskdump.c | 34 ++++++++++++++++++++++++++++++++++
diskdump.h | 2 ++
3 files changed, 40 insertions(+), 0 deletions(-)

--

Thanks.
HATAYAMA, Daisuke

From a93539aee34d6abb9ef19f33a438f79b7d26efef Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Date: Tue, 3 Jul 2012 11:43:30 +0900
Subject: [PATCH 1/3] Add dump header for snappy

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---
diskdump.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/diskdump.h b/diskdump.h
index bd99fbd..83fe009 100644
--- a/diskdump.h
+++ b/diskdump.h
@@ -74,6 +74,8 @@ struct kdump_sub_header {
/* page flags */
#define DUMP_DH_COMPRESSED_ZLIB 0x1 /* page is compressed with zlib */
#define DUMP_DH_COMPRESSED_LZO 0x2 /* page is compressed with lzo */
+#define DUMP_DH_COMPRESSED_SNAPPY 0x4
+ /* page is compressed with snappy */

/* descriptor of each page for vmcore */
typedef struct page_desc {
--
1.7.7.6

From f521776ba910dee7352ca8ec31fa305929e36758 Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Date: Tue, 3 Jul 2012 11:43:30 +0900
Subject: [PATCH 2/3] Add snappy supporting flag

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---
defs.h | 1 +
diskdump.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/defs.h b/defs.h
index caa87c0..8eebc52 100755
--- a/defs.h
+++ b/defs.h
@@ -283,6 +283,7 @@ struct number_option {
#define DUMPFILE_SPLIT (0x10)
#define NO_ELF_NOTES (0x20)
#define LZO_SUPPORTED (0x40)
+#define SNAPPY_SUPPORTED (0x80)
#define DISKDUMP_VALID() (dd->flags & DISKDUMP_LOCAL)
#define KDUMP_CMPRS_VALID() (dd->flags & KDUMP_CMPRS_LOCAL)
#define KDUMP_SPLIT() (dd->flags & DUMPFILE_SPLIT)
diff --git a/diskdump.c b/diskdump.c
index d80eea4..4d194c5 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -682,6 +682,10 @@ is_diskdump(char *file)
dd->flags |= LZO_SUPPORTED;
#endif

+#ifdef SNAPPY
+ dd->flags |= SNAPPY_SUPPORTED;
+#endif
+
return TRUE;
}

@@ -1309,6 +1313,8 @@ __diskdump_memory_dump(FILE *fp)
fprintf(fp, "%sNO_ELF_NOTES", others++ ? "|" : "");
if (dd->flags & LZO_SUPPORTED)
fprintf(fp, "%sLZO_SUPPORTED", others++ ? "|" : "");
+ if (dd->flags & SNAPPY_SUPPORTED)
+ fprintf(fp, "%sSNAPPY_SUPPORTED", others++ ? "|" : "");
fprintf(fp, ") %s
", FLAT_FORMAT() ? "[FLAT]" : "");
fprintf(fp, " dfd: %d
", dd->dfd);
fprintf(fp, " ofp: %lx
", (ulong)dd->ofp);
--
1.7.7.6

From 7bf06a5c3e2db2ab8a1e566dbdfcd46a57ad2a43 Mon Sep 17 00:00:00 2001
From: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Date: Tue, 3 Jul 2012 11:43:30 +0900
Subject: [PATCH 3/3] Add uncompression processing

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---
defs.h | 3 +++
diskdump.c | 28 ++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/defs.h b/defs.h
index 8eebc52..f938c8c 100755
--- a/defs.h
+++ b/defs.h
@@ -51,6 +51,9 @@
#ifdef LZO
#include <lzo/lzo1x.h>
#endif
+#ifdef SNAPPY
+#include <snappy-c.h>
+#endif

#ifndef ATTRIBUTE_UNUSED
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
diff --git a/diskdump.c b/diskdump.c
index 4d194c5..39f4652 100644
--- a/diskdump.c
+++ b/diskdump.c
@@ -874,6 +874,34 @@ cache_page(physaddr_t paddr)
return READ_ERROR;
}
#endif
+ } else if (pd.flags & DUMP_DH_COMPRESSED_SNAPPY) {
+
+ if (!(dd->flags & SNAPPY_SUPPORTED)) {
+ error(INFO, "%s: uncompress failed: no snappy compression support
",
+ DISKDUMP_VALID() ? "diskdump" : "compressed kdump");
+ return READ_ERROR;
+ }
+
+#ifdef SNAPPY
+ ret = snappy_uncompressed_length((char *)dd->compressed_page,
+ pd.size, &retlen);
+ if (ret != SNAPPY_OK) {
+ error(INFO, "%s: uncompress failed: %d
",
+ DISKDUMP_VALID() ? "diskdump" : "compressed kdump",
+ ret);
+ return READ_ERROR;
+ }
+
+ ret = snappy_uncompress((char *)dd->compressed_page, pd.size,
+ (char *)dd->page_cache_hdr[i].pg_bufptr,
+ &retlen);
+ if ((ret != SNAPPY_OK) || (retlen != block_size)) {
+ error(INFO, "%s: uncompress failed: %d
",
+ DISKDUMP_VALID() ? "diskdump" : "compressed kdump",
+ ret);
+ return READ_ERROR;
+ }
+#endif
} else
memcpy(dd->page_cache_hdr[i].pg_bufptr,
dd->compressed_page, block_size);
--
1.7.7.6

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 

Thread Tools




All times are GMT. The time now is 03:45 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org