In current implementation, when generating kdump core, it behaves as the following logic. 1. Write page header into the buffer cd_header. 2. If buffer is full, flush the buffer. 3. Write page data into the buffer cd_page. 4. If buffer is full, flush the buffer. When enospc occurs in flushing cd_page, it always still has much data in cd_header. The size of page data is 170 times the size of page header. It leads to that quite a lot of page data been written into file can't be used. The page header may also meet that. The page data can be compressed, so the size of page data can also be much smaller than the size of page header. This patch set changes the logic of generating kdump core. The new logic is: 1. Before writing page header and data into buffer, if the buffer will be full, write the data of the buffer into file. 2. Then, write the page header and data info buffer. When enospc occurs in writing the cd_header into file, fill the cd_header with zero and re-write the cd_header. When enospc occurs in writing the cd_page into file, fill part of the cd_header with zero according to how many pages in cd_page have been written. Zhou Wenjian (4): Add write_cd_buf Add get_pfn_offset Add write_kdump_page Use write_kdump_page instead of write_cache in write_kdump_pages_cyclic makedumpfile.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 96 insertions(+), 11 deletions(-) -- 1.8.3.1