public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Dave Anderson <anderson@redhat.com>
To: kexec@lists.infradead.org
Subject: [PATCH / RFC] makedumpfile header to show LZO/snappy/zlib
Date: Thu, 12 Sep 2013 10:35:12 -0400 (EDT)	[thread overview]
Message-ID: <1099586971.12086400.1378996512279.JavaMail.root@redhat.com> (raw)
In-Reply-To: <1632896047.12077061.1378995804236.JavaMail.root@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1758 bytes --]


With the advent of LZO and snappy compression support, it would be
helpful if it could be readily determined which type of compression 
was used to create the dumpfile.  

The zlib/LZO/snappy indicator is only found down in the bowels of each 
page_desc structure:
  
  /* page flags */
  #define DUMP_DH_COMPRESSED_ZLIB 0x1     /* page is compressed with zlib */
  #define DUMP_DH_COMPRESSED_LZO  0x2     /* paged is compressed with lzo */
  #define DUMP_DH_COMPRESSED_SNAPPY       0x4
                                          /* paged is compressed with snappy */
  
  /* descriptor of each page for vmcore */
  typedef struct page_desc {
          off_t                   offset;         /* the offset of the page data*/
          unsigned int            size;           /* the size of this dump page */
          unsigned int            flags;          /* flags */
          unsigned long long      page_flags;     /* page flags */
  } page_desc_t;

The compressed kdump's header does contain a "status" flag:

  struct disk_dump_header {
          char                    signature[SIG_LEN];     /* = "KDUMP   " */
          int                     header_version; /* Dump header version */
          struct new_utsname      utsname;        /* copy of system_utsname */
          struct timeval          timestamp;      /* Time stamp */
          unsigned int            status;         /* Above flags */
  ...

which has these 3 flags:

  #define DUMP_HEADER_COMPLETED   0
  #define DUMP_HEADER_INCOMPLETED 1
  #define DUMP_HEADER_COMPRESSED  8

But they are all remnants of the old "diskdump" facility, and none of them
are ever used by makedumpfile.

Any chance that the LZO/snappy/zlib method could also be put up in 
the disk_dump_header? 

Dave

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: compression_header.patch --]
[-- Type: text/x-patch; name=compression_header.patch, Size: 796 bytes --]

--- makedumpfile-1.5.4/makedumpfile.c.orig
+++ makedumpfile-1.5.4/makedumpfile.c
@@ -5162,6 +5162,16 @@ write_kdump_header(void)
 	dh->bitmap_blocks  = divideup(info->len_bitmap, dh->block_size);
 	memcpy(&dh->timestamp, &info->timestamp, sizeof(dh->timestamp));
 	memcpy(&dh->utsname, &info->system_utsname, sizeof(dh->utsname));
+	if (info->flag_compress & DUMP_DH_COMPRESSED_ZLIB)
+		dh->status |= DUMP_DH_COMPRESSED_ZLIB; 
+#ifdef USELZO
+	else if (info->flag_compress & DUMP_DH_COMPRESSED_LZO)
+		dh->status |= DUMP_DH_COMPRESSED_LZO)
+#endif
+#ifdef USESNAPPY
+	else if (info->flag_compress & DUMP_DH_COMPRESSED_SNAPPY)
+		dh->status |= DUMP_DH_COMPRESSED_SNAPPY)
+#endif
 
 	size = sizeof(struct disk_dump_header);
 	if (!write_buffer(info->fd_dumpfile, 0, dh, size, info->name_dumpfile))

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

       reply	other threads:[~2013-09-12 14:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1632896047.12077061.1378995804236.JavaMail.root@redhat.com>
2013-09-12 14:35 ` Dave Anderson [this message]
2013-09-20  4:21   ` [PATCH / RFC] makedumpfile header to show LZO/snappy/zlib Atsushi Kumagai
2013-09-20 13:04     ` Dave Anderson
2013-09-26 13:31       ` Petr Tesarik
2013-09-26 17:05         ` Dave Anderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1099586971.12086400.1378996512279.JavaMail.root@redhat.com \
    --to=anderson@redhat.com \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox