Always return at least one parity region. Fixes PR#44239.

Fix from oster@, code (such as it is) by me.
This commit is contained in:
riz 2011-03-01 22:51:14 +00:00
parent 5bf2d32443
commit 213d0d6de1
1 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rf_paritymap.c,v 1.5 2010/03/14 21:11:41 jld Exp $ */ /* $NetBSD: rf_paritymap.c,v 1.6 2011/03/01 22:51:14 riz Exp $ */
/*- /*-
* Copyright (c) 2009 Jed Davis. * Copyright (c) 2009 Jed Davis.
@ -27,7 +27,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.5 2010/03/14 21:11:41 jld Exp $"); __KERNEL_RCSID(0, "$NetBSD: rf_paritymap.c,v 1.6 2011/03/01 22:51:14 riz Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/callout.h> #include <sys/callout.h>
@ -409,6 +409,8 @@ rf_paritymap_nreg(RF_Raid_t *raid)
nreg = bytes_per_disk / REGION_MINSIZE; nreg = bytes_per_disk / REGION_MINSIZE;
if (nreg > RF_PARITYMAP_NREG) if (nreg > RF_PARITYMAP_NREG)
nreg = RF_PARITYMAP_NREG; nreg = RF_PARITYMAP_NREG;
if (nreg < 1)
nreg = 1;
return (u_int)nreg; return (u_int)nreg;
} }