[RFC PATCH 2/4] makedumpfile: Add partial bitmap for cyclic.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Nishimura-san,

On Thu, 31 May 2012 17:33:07 +0900
Daisuke Nishimura <nishimura at mxp.nes.nec.co.jp> wrote:

> From the POV of adding partial bitmaps, I think it would be better to include
> following hunks in [3/4] into [2/4].

The functions below are just initializer for partial bitmaps, so it may be better
to include them in [2/4] as you said. Thank you for your advice.


Thanks
Atsushi Kumagai

> > @@ -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.



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux