Tomasz Majchrzak <tomasz.majchrzak@xxxxxxxxx> writes: > Pre-allocate memory for largest possible bad block sectionwhen monitor > is being opened to avoid a need for memory allocation on metadata sync. > > If memory for a structure has been allocated in mpb buffer but it hasn't > been used yet, it will be taken by next buffer grow, leading to > insufficient memory on metadata flush. Start tracking such memory and > take it into calculation when growing a buffer. Also assert has been > added to debug mode to warn when more metadata has been written than > memory allocated. > > Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@xxxxxxxxx> > --- > super-intel.c | 49 +++++++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 45 insertions(+), 4 deletions(-) > > diff --git a/super-intel.c b/super-intel.c > index 5d6d534..0591c55 100644 > --- a/super-intel.c > +++ b/super-intel.c [snip] > @@ -8854,6 +8886,9 @@ static void imsm_process_update(struct supertype *st, > } > break; > } > + case update_prealloc_badblocks_mem: { > + break; > + } > default: > pr_err("error: unsuported process update type:(type: %d)\n", type); > } Please don't include those awful brackets if you don't need them here. > @@ -9094,6 +9129,11 @@ static int imsm_prepare_update(struct supertype *st, > case update_add_remove_disk: > /* no update->len needed */ > break; > + case update_prealloc_badblocks_mem: { > + super->extra_space += sizeof(struct bbm_log) - > + get_imsm_bbm_log_size(super->bbm_log); > + break; > + } > default: > return 0; > } Same here Thanks, Jes -- To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html