mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl/boot: Add print_progress parameter to write_addr_range()
With current implementation, printing progress while writing a compressed data chunk might be very inaccurate. Thus, for compressed dump segments skip progress_print() in write_addr_range() and call it after each compressed memory chunk is written to disk. For that change write_addr_range() to call progress_print() conditionally based on the new print_progress parameter. For non-compressed dump segments, call progress_print() from write_addr_range() just as before. Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com> Acked-by: Alexander Egorenkov <egorenar@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
c61783546b
commit
e35d05a5e3
@@ -451,7 +451,8 @@ void readblock(unsigned long blk, unsigned long addr, unsigned long blk_count)
|
||||
* given block and return the next free block number. The len value must be
|
||||
* a multiple of a block size (4096 bytes).
|
||||
*/
|
||||
unsigned long write_addr_range(unsigned long blk, unsigned long start, unsigned long len)
|
||||
unsigned long write_addr_range(unsigned long blk, unsigned long start,
|
||||
unsigned long len, int print_progress)
|
||||
{
|
||||
unsigned long addr, start_blk, blk_count, zero_page;
|
||||
|
||||
@@ -468,8 +469,9 @@ unsigned long write_addr_range(unsigned long blk, unsigned long start, unsigned
|
||||
zero_page = get_zeroed_page();
|
||||
writeblock(blk, addr, blk_count, zero_page);
|
||||
free_page(zero_page);
|
||||
progress_print(addr);
|
||||
blk += blk_count;
|
||||
if (print_progress)
|
||||
progress_print(addr);
|
||||
addr += b2m(blk_count);
|
||||
}
|
||||
return blk;
|
||||
@@ -491,7 +493,7 @@ unsigned long write_dump_segment(unsigned long blk,
|
||||
free_page(zero_page);
|
||||
blk += m2b(PAGE_SIZE);
|
||||
/* Write the dump segment */
|
||||
return write_addr_range(blk, segm->start, segm->len);
|
||||
return write_addr_range(blk, segm->start, segm->len, PRINT_PROGRESS);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -51,6 +51,9 @@ void writeblock(unsigned long blk, unsigned long addr, unsigned long blk_count,
|
||||
void readblock(unsigned long blk, unsigned long addr, unsigned long blk_count);
|
||||
unsigned long write_dump_segment(unsigned long blk,
|
||||
struct df_s390_dump_segm_hdr *segm);
|
||||
unsigned long write_addr_range(unsigned long blk, unsigned long addr, unsigned long len);
|
||||
#define NO_PROGRESS 0
|
||||
#define PRINT_PROGRESS 1
|
||||
unsigned long write_addr_range(unsigned long blk, unsigned long addr,
|
||||
unsigned long len, int print_progress);
|
||||
|
||||
#endif /* ECKD2DUMP_H */
|
||||
|
||||
@@ -79,7 +79,7 @@ static int compress_write_next_chunk(unsigned long addr, unsigned long len,
|
||||
* notify the caller.
|
||||
*/
|
||||
if (rc != Z_OK) {
|
||||
*blk = write_addr_range(start_blk, addr, len);
|
||||
*blk = write_addr_range(start_blk, addr, len, NO_PROGRESS);
|
||||
return COMPRESSION_ERROR;
|
||||
}
|
||||
if (strm->avail_out == 0) {
|
||||
@@ -90,11 +90,11 @@ static int compress_write_next_chunk(unsigned long addr, unsigned long len,
|
||||
*/
|
||||
if (strm->total_out >= strm->total_in &&
|
||||
*blk == start_blk) {
|
||||
*blk = write_addr_range(start_blk, addr, len);
|
||||
*blk = write_addr_range(start_blk, addr, len, NO_PROGRESS);
|
||||
return UNCOMPRESSED;
|
||||
}
|
||||
*blk = write_addr_range(*blk, (unsigned long)zlib_out_buf,
|
||||
zlib_buf_size);
|
||||
zlib_buf_size, NO_PROGRESS);
|
||||
strm->next_out = (void *)zlib_out_buf;
|
||||
strm->avail_out = zlib_buf_size;
|
||||
}
|
||||
@@ -104,7 +104,7 @@ static int compress_write_next_chunk(unsigned long addr, unsigned long len,
|
||||
strm->avail_in = 0;
|
||||
rc = zlib_deflate(strm, Z_FINISH);
|
||||
len = ROUND_UP(zlib_buf_size - strm->avail_out, PAGE_SIZE);
|
||||
*blk = write_addr_range(*blk, (unsigned long)zlib_out_buf, len);
|
||||
*blk = write_addr_range(*blk, (unsigned long)zlib_out_buf, len, NO_PROGRESS);
|
||||
if (strm->avail_out == 0) {
|
||||
strm->next_out = zlib_out_buf;
|
||||
strm->avail_out = zlib_buf_size;
|
||||
@@ -165,6 +165,7 @@ unsigned long write_compressed_dump_segment(unsigned long blk,
|
||||
if (rc == UNCOMPRESSED || rc == COMPRESSION_ERROR)
|
||||
segm->entry_offset[i] |= DUMP_SEGM_ENTRY_UNCOMPRESSED;
|
||||
offset += blk - start_blk;
|
||||
/* Print progress after each compressed chunk written */
|
||||
progress_print(segm->start + i * chunk_size);
|
||||
}
|
||||
/* Compression successful, store compressed size in the segment header */
|
||||
|
||||
Reference in New Issue
Block a user