mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
Increase the auxiliary buffer size from 8 pages to 1 megabyte in order to significantly increase compressed dump processing speed. For uncompressed dumps, the effect is minor. Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com> Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
48 lines
1.1 KiB
C
48 lines
1.1 KiB
C
/*
|
|
* zgetdump - Tool for copying and converting System z dumps
|
|
*
|
|
* Write dump to the file descriptor (fd)
|
|
*
|
|
* Copyright IBM Corp. 2001, 2017
|
|
*
|
|
* s390-tools is free software; you can redistribute it and/or modify
|
|
* it under the terms of the MIT license. See LICENSE for details.
|
|
*/
|
|
|
|
#include "zg.h"
|
|
#include "dfi.h"
|
|
#include "dfo.h"
|
|
#include "output.h"
|
|
|
|
#define BUFFER_SIZE (1 * MIB)
|
|
|
|
int write_dump(FILE *stream)
|
|
{
|
|
const u64 output_size = dfo_size();
|
|
char *buf = zg_alloc(BUFFER_SIZE);
|
|
u64 written = 0;
|
|
|
|
if (!dfi_feat_copy())
|
|
ERR_EXIT("Copying not possible for %s dumps", dfi_name());
|
|
STDERR("Format Info:\n");
|
|
STDERR(" Source: %s\n", dfi_name());
|
|
STDERR(" Target: %s\n", dfo_name());
|
|
STDERR("\n");
|
|
zg_progress_init("Copying dump", output_size);
|
|
while (written != output_size) {
|
|
size_t rc;
|
|
u64 cnt;
|
|
|
|
cnt = dfo_read(buf, BUFFER_SIZE);
|
|
rc = fwrite(buf, cnt, 1, stream);
|
|
if (rc != 1 && ferror(stream))
|
|
ERR_EXIT("Error: Write failed");
|
|
written += cnt;
|
|
zg_progress(written);
|
|
};
|
|
STDERR("\n");
|
|
STDERR("Success: Dump has been copied\n");
|
|
zg_free(buf);
|
|
return 0;
|
|
}
|