[RFC PATCH 2/4] makedumpfile: Add partial bitmap for cyclic.
Daisuke Nishimura
nishimura at mxp.nes.nec.co.jp
Thu May 31 04:33:07 EDT 2012
>From the POV of adding partial bitmaps, I think it would be better to include
following hunks in [3/4] into [2/4].
> @@ -3954,6 +4019,39 @@ prepare_bitmap_buffer(void)
> return TRUE;
> }
>
> +int
> +prepare_bitmap_buffer_cyclic(void)
> +{
> + unsigned long tmp;
> +
> + /*
> + * Create 2 bitmaps (1st-bitmap & 2nd-bitmap) on block_size boundary.
> + * The crash utility requires both of them to be aligned to block_size
> + * boundary.
> + */
> + tmp = divideup(divideup(info->max_mapnr, BITPERBYTE), info->page_size);
> + info->len_bitmap = tmp*info->page_size*2;
> +
> +
> + /*
> + * Prepare bitmap buffers for creating dump bitmap.
> + */
> + if ((info->partial_bitmap1 = (char *)malloc(BUFSIZE_CYCLIC)) == NULL) {
> + ERRMSG("Can't allocate memory for the 1st-bitmap. %s\n",
> + strerror(errno));
> + return FALSE;
> + }
> + if ((info->partial_bitmap2 = (char *)malloc(BUFSIZE_CYCLIC)) == NULL) {
> + ERRMSG("Can't allocate memory for the 2nd-bitmap. %s\n",
> + strerror(errno));
> + return FALSE;
> + }
> + initialize_bitmap_cyclic(info->partial_bitmap1);
> + initialize_bitmap_cyclic(info->partial_bitmap2);
> +
> + return TRUE;
> +}
> +
> void
> free_bitmap_buffer(void)
> {
> @@ -3974,14 +4072,17 @@ create_dump_bitmap(void)
> {
> int ret = FALSE;
>
> - if (!prepare_bitmap_buffer())
> - goto out;
> -
> - if (!create_1st_bitmap())
> - goto out;
> -
> - if (!create_2nd_bitmap())
> - goto out;
> + if (info->flag_cyclic) {
> + if (!prepare_bitmap_buffer_cyclic())
> + goto out;
> + } else {
> + if (!prepare_bitmap_buffer())
> + goto out;
> + if (!create_1st_bitmap())
> + goto out;
> + if (!create_2nd_bitmap())
> + goto out;
> + }
>
> ret = TRUE;
> out:
...
> @@ -7242,6 +7364,10 @@ out:
> free(info->splitting_info);
> if (info->p2m_mfn_frame_list != NULL)
> free(info->p2m_mfn_frame_list);
> + if (info->partial_bitmap1 != NULL)
> + free(info->partial_bitmap1);
> + if (info->partial_bitmap2 != NULL)
> + free(info->partial_bitmap2);
> free(info);
> }
> free_elf_info();
Thanks,
Daisuke Nishimura.
More information about the kexec
mailing list