Date: Tue, 29 Dec 2009 21:41:51 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r201220 - stable/7/sys/geom/raid3 Message-ID: <200912292141.nBTLfpq9037005@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Tue Dec 29 21:41:51 2009 New Revision: 201220 URL: http://svn.freebsd.org/changeset/base/201220 Log: MFC r200821: Make graid3 fallback to malloc() when component request size is bigger then maximal prepared UMA zone size. This fixes crash with MAXPHYS > 128K. Modified: stable/7/sys/geom/raid3/g_raid3.c stable/7/sys/geom/raid3/g_raid3.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/geom/raid3/g_raid3.c ============================================================================== --- stable/7/sys/geom/raid3/g_raid3.c Tue Dec 29 21:23:18 2009 (r201219) +++ stable/7/sys/geom/raid3/g_raid3.c Tue Dec 29 21:41:51 2009 (r201220) @@ -183,15 +183,17 @@ static void * g_raid3_alloc(struct g_raid3_softc *sc, size_t size, int flags) { void *ptr; + enum g_raid3_zones zone; - if (g_raid3_use_malloc) + if (g_raid3_use_malloc || + (zone = g_raid3_zone(size)) == G_RAID3_NUM_ZONES) ptr = malloc(size, M_RAID3, flags); else { - ptr = uma_zalloc_arg(sc->sc_zones[g_raid3_zone(size)].sz_zone, - &sc->sc_zones[g_raid3_zone(size)], flags); - sc->sc_zones[g_raid3_zone(size)].sz_requested++; + ptr = uma_zalloc_arg(sc->sc_zones[zone].sz_zone, + &sc->sc_zones[zone], flags); + sc->sc_zones[zone].sz_requested++; if (ptr == NULL) - sc->sc_zones[g_raid3_zone(size)].sz_failed++; + sc->sc_zones[zone].sz_failed++; } return (ptr); } @@ -199,12 +201,14 @@ g_raid3_alloc(struct g_raid3_softc *sc, static void g_raid3_free(struct g_raid3_softc *sc, void *ptr, size_t size) { + enum g_raid3_zones zone; - if (g_raid3_use_malloc) + if (g_raid3_use_malloc || + (zone = g_raid3_zone(size)) == G_RAID3_NUM_ZONES) free(ptr, M_RAID3); else { - uma_zfree_arg(sc->sc_zones[g_raid3_zone(size)].sz_zone, - ptr, &sc->sc_zones[g_raid3_zone(size)]); + uma_zfree_arg(sc->sc_zones[zone].sz_zone, + ptr, &sc->sc_zones[zone]); } } Modified: stable/7/sys/geom/raid3/g_raid3.h ============================================================================== --- stable/7/sys/geom/raid3/g_raid3.h Tue Dec 29 21:23:18 2009 (r201219) +++ stable/7/sys/geom/raid3/g_raid3.h Tue Dec 29 21:41:51 2009 (r201220) @@ -183,7 +183,9 @@ enum g_raid3_zones { static __inline enum g_raid3_zones g_raid3_zone(size_t nbytes) { - if (nbytes > 16384) + if (nbytes > 65536) + return (G_RAID3_NUM_ZONES); + else if (nbytes > 16384) return (G_RAID3_ZONE_64K); else if (nbytes > 4096) return (G_RAID3_ZONE_16K);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912292141.nBTLfpq9037005>