Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe Extensive mechanical changes to the pools ...



details:   https://anonhg.NetBSD.org/src/rev/9f285f822963
branches:  trunk
changeset: 1022503:9f285f822963
user:      oster <oster%NetBSD.org@localhost>
date:      Fri Jul 23 00:54:45 2021 +0000

description:
Extensive mechanical changes to the pools used in RAIDframe.

Alloclist remains not per-RAID, so initialize that pool
separately/differently than the rest.

The remainder of pools in RF_Pools_s are now per-RAID pools.  Mostly
mechanical changes to functions to allocate/destroy per-RAID pools.
Needed to make raidPtr available in certain cases to be able to find
the per-RAID pools.

Extend rf_pool_init() to now populate a per-RAID wchan value that is
unique to each pool for a given RAID device.

TODO: Complete the analysis of the minimum number of items that are
required for each pool to allow IO to progress (i.e. so that a request
for pool resources can always be satisfied), and dynamically scale
minimum pool sizes based on RAID configuration.

diffstat:

 sys/dev/raidframe/rf_alloclist.c        |   16 +-
 sys/dev/raidframe/rf_aselect.c          |   48 +++++-----
 sys/dev/raidframe/rf_callback.c         |   44 +++++----
 sys/dev/raidframe/rf_callback.h         |   13 +-
 sys/dev/raidframe/rf_copyback.c         |    8 +-
 sys/dev/raidframe/rf_dagdegrd.c         |   30 +++---
 sys/dev/raidframe/rf_dagdegwr.c         |   26 ++--
 sys/dev/raidframe/rf_dagffrd.c          |   20 ++--
 sys/dev/raidframe/rf_dagffwr.c          |   50 +++++-----
 sys/dev/raidframe/rf_dagutils.c         |  123 ++++++++++++++-----------
 sys/dev/raidframe/rf_dagutils.h         |   24 ++--
 sys/dev/raidframe/rf_diskqueue.c        |   36 ++++---
 sys/dev/raidframe/rf_diskqueue.h        |    4 +-
 sys/dev/raidframe/rf_driver.c           |   68 ++++++++------
 sys/dev/raidframe/rf_evenodd.c          |   10 +-
 sys/dev/raidframe/rf_map.c              |  150 ++++++++++++++++---------------
 sys/dev/raidframe/rf_map.h              |   36 +++---
 sys/dev/raidframe/rf_mcpair.c           |   30 +++--
 sys/dev/raidframe/rf_mcpair.h           |    8 +-
 sys/dev/raidframe/rf_netbsd.h           |   36 ++++++-
 sys/dev/raidframe/rf_netbsdkintf.c      |   12 +-
 sys/dev/raidframe/rf_paritylogDiskMgr.c |   36 +++---
 sys/dev/raidframe/rf_parityscan.c       |   22 ++--
 sys/dev/raidframe/rf_psstatus.c         |   24 ++--
 sys/dev/raidframe/rf_psstatus.h         |    4 +-
 sys/dev/raidframe/rf_raid.h             |    4 +-
 sys/dev/raidframe/rf_raid1.c            |   12 +-
 sys/dev/raidframe/rf_reconbuffer.c      |   10 +-
 sys/dev/raidframe/rf_reconstruct.c      |   39 ++++---
 sys/dev/raidframe/rf_reconstruct.h      |    4 +-
 sys/dev/raidframe/rf_reconutil.c        |    8 +-
 sys/dev/raidframe/rf_revent.c           |   35 ++++---
 sys/dev/raidframe/rf_revent.h           |    6 +-
 sys/dev/raidframe/rf_states.c           |   17 +-
 sys/dev/raidframe/rf_stripelocks.c      |   43 +++++----
 sys/dev/raidframe/rf_stripelocks.h      |   10 +-
 36 files changed, 583 insertions(+), 483 deletions(-)

diffs (truncated from 3071 to 300 lines):

diff -r 816c3e567eed -r 9f285f822963 sys/dev/raidframe/rf_alloclist.c
--- a/sys/dev/raidframe/rf_alloclist.c  Fri Jul 23 00:26:19 2021 +0000
+++ b/sys/dev/raidframe/rf_alloclist.c  Fri Jul 23 00:54:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_alloclist.c,v 1.28 2019/02/10 17:13:33 christos Exp $       */
+/*     $NetBSD: rf_alloclist.c,v 1.29 2021/07/23 00:54:45 oster Exp $  */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -37,7 +37,7 @@
  ***************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.28 2019/02/10 17:13:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.29 2021/07/23 00:54:45 oster Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -59,15 +59,17 @@
 
 static void rf_ShutdownAllocList(void *ignored)
 {
-       pool_destroy(&rf_pools.alloclist);
+       pool_destroy(&rf_alloclist_pool);
 }
 
 int
 rf_ConfigureAllocList(RF_ShutdownList_t **listp)
 {
 
-       rf_pool_init(&rf_pools.alloclist, sizeof(RF_AllocListElem_t),
-                    "rf_alloclist_pl", RF_AL_FREELIST_MIN, RF_AL_FREELIST_MAX);
+       pool_init(&rf_alloclist_pool, sizeof(RF_AllocListElem_t), 0, 0, 0, "rf_alloclist_pl", NULL, IPL_BIO);
+       pool_sethiwat(&rf_alloclist_pool, RF_AL_FREELIST_MAX);
+       pool_prime(&rf_alloclist_pool, RF_AL_FREELIST_MIN);
+
        rf_ShutdownCreate(listp, rf_ShutdownAllocList, NULL);
 
        return (0);
@@ -115,12 +117,12 @@
        while (l) {
                temp = l;
                l = l->next;
-               pool_put(&rf_pools.alloclist, temp);
+               pool_put(&rf_alloclist_pool, temp);
        }
 }
 
 RF_AllocListElem_t *
 rf_real_MakeAllocList(void)
 {
-       return pool_get(&rf_pools.alloclist, PR_WAITOK | PR_ZERO);
+       return pool_get(&rf_alloclist_pool, PR_WAITOK | PR_ZERO);
 }
diff -r 816c3e567eed -r 9f285f822963 sys/dev/raidframe/rf_aselect.c
--- a/sys/dev/raidframe/rf_aselect.c    Fri Jul 23 00:26:19 2021 +0000
+++ b/sys/dev/raidframe/rf_aselect.c    Fri Jul 23 00:54:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_aselect.c,v 1.29 2017/01/04 15:50:34 christos Exp $ */
+/*     $NetBSD: rf_aselect.c,v 1.30 2021/07/23 00:54:45 oster Exp $    */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  *****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_aselect.c,v 1.29 2017/01/04 15:50:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_aselect.c,v 1.30 2021/07/23 00:54:45 oster Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -58,7 +58,7 @@
 InitHdrNode(RF_DagHeader_t **hdr, RF_Raid_t *raidPtr, RF_RaidAccessDesc_t *desc)
 {
        /* create and initialize dag hdr */
-       *hdr = rf_AllocDAGHeader();
+       *hdr = rf_AllocDAGHeader(raidPtr);
        rf_MakeAllocList((*hdr)->allocList);
        (*hdr)->status = rf_enable;
        (*hdr)->numSuccedents = 0;
@@ -149,7 +149,7 @@
        desc->numStripes = 0;
        for (i = 0, asm_p = asmap; asm_p; asm_p = asm_p->next, i++) {
                desc->numStripes++;
-               stripeFuncs = rf_AllocFuncList();
+               stripeFuncs = rf_AllocFuncList(raidPtr);
 
                if (stripeFuncsEnd == NULL) {
                        stripeFuncsList = stripeFuncs;
@@ -166,7 +166,7 @@
                         * unit in the stripe */
 
                        /* create a failed stripe structure to attempt to deal with the failure */
-                       failed_stripe = rf_AllocFailedStripeStruct();
+                       failed_stripe = rf_AllocFailedStripeStruct(raidPtr);
                        if (failed_stripes_list == NULL) {
                                failed_stripes_list = failed_stripe;
                                failed_stripes_list_end = failed_stripe;
@@ -189,7 +189,7 @@
                                length = physPtr->numSector;
                                buffer = physPtr->bufPtr;
 
-                               asmhle = rf_AllocASMHeaderListElem();
+                               asmhle = rf_AllocASMHeaderListElem(raidPtr);
                                if (failed_stripe->asmh_u == NULL) {
                                        failed_stripe->asmh_u = asmhle;      /* we're the head... */
                                        failed_stripes_asmh_u_end = asmhle;  /* and the tail      */
@@ -203,7 +203,7 @@
                                asmhle->asmh = rf_MapAccess(raidPtr, address, length, buffer, RF_DONT_REMAP);
                                asm_up = asmhle->asmh->stripeMap;
 
-                               vfple = rf_AllocVFPListElem();
+                               vfple = rf_AllocVFPListElem(raidPtr);
                                if (failed_stripe->vfple == NULL) {
                                        failed_stripe->vfple = vfple;
                                        failed_stripes_vfple_end = vfple;
@@ -236,7 +236,7 @@
                                                length = 1;
                                                buffer = (char *)physPtr->bufPtr + (k * (1 << raidPtr->logBytesPerSector));
 
-                                               asmhle = rf_AllocASMHeaderListElem();
+                                               asmhle = rf_AllocASMHeaderListElem(raidPtr);
                                                if (failed_stripe->asmh_b == NULL) {
                                                        failed_stripe->asmh_b = asmhle;
                                                        failed_stripes_asmh_b_end = asmhle;
@@ -248,7 +248,7 @@
                                                asmhle->asmh = rf_MapAccess(raidPtr, address, length, buffer, RF_DONT_REMAP);
                                                asm_bp = asmhle->asmh->stripeMap;
 
-                                               vfple = rf_AllocVFPListElem();
+                                               vfple = rf_AllocVFPListElem(raidPtr);
                                                if (failed_stripe->bvfple == NULL) {
                                                        failed_stripe->bvfple = vfple;
                                                        failed_stripes_bvfple_end = vfple;
@@ -286,37 +286,37 @@
                                        while (asmhle) {
                                                tmpasmhle= asmhle;
                                                asmhle = tmpasmhle->next;
-                                               rf_FreeAccessStripeMap(tmpasmhle->asmh);
-                                               rf_FreeASMHeaderListElem(tmpasmhle);
+                                               rf_FreeAccessStripeMap(raidPtr, tmpasmhle->asmh);
+                                               rf_FreeASMHeaderListElem(raidPtr, tmpasmhle);
                                        }
 
                                        asmhle = failed_stripe->asmh_b;
                                        while (asmhle) {
                                                tmpasmhle= asmhle;
                                                asmhle = tmpasmhle->next;
-                                               rf_FreeAccessStripeMap(tmpasmhle->asmh);
-                                               rf_FreeASMHeaderListElem(tmpasmhle);
+                                               rf_FreeAccessStripeMap(raidPtr, tmpasmhle->asmh);
+                                               rf_FreeASMHeaderListElem(raidPtr, tmpasmhle);
                                        }
 
                                        vfple = failed_stripe->vfple;
                                        while (vfple) {
                                                tmpvfple = vfple;
                                                vfple = tmpvfple->next;
-                                               rf_FreeVFPListElem(tmpvfple);
+                                               rf_FreeVFPListElem(raidPtr, tmpvfple);
                                        }
 
                                        vfple = failed_stripe->bvfple;
                                        while (vfple) {
                                                tmpvfple = vfple;
                                                vfple = tmpvfple->next;
-                                               rf_FreeVFPListElem(tmpvfple);
+                                               rf_FreeVFPListElem(raidPtr, tmpvfple);
                                        }
 
                                        stripeNum++;
                                        /* only move to the next failed stripe slot if the current one was used */
                                        tmpfailed_stripe = failed_stripe;
                                        failed_stripe = failed_stripe->next;
-                                       rf_FreeFailedStripeStruct(tmpfailed_stripe);
+                                       rf_FreeFailedStripeStruct(raidPtr, tmpfailed_stripe);
                                }
                                stripeFuncs = stripeFuncs->next;
                        }
@@ -325,7 +325,7 @@
                while (stripeFuncsList != NULL) {
                        temp = stripeFuncsList;
                        stripeFuncsList = stripeFuncsList->next;
-                       rf_FreeFuncList(temp);
+                       rf_FreeFuncList(raidPtr, temp);
                }
                desc->numStripes = 0;
                return (1);
@@ -344,7 +344,7 @@
                        /* grab dag header for this stripe */
                        dag_h = NULL;
 
-                       dagList = rf_AllocDAGList();
+                       dagList = rf_AllocDAGList(raidPtr);
 
                        /* always tack the new dagList onto the end of the list... */
                        if (dagListend == NULL) {
@@ -505,38 +505,38 @@
                                while (asmhle) {
                                        tmpasmhle= asmhle;
                                        asmhle = tmpasmhle->next;
-                                       rf_FreeASMHeaderListElem(tmpasmhle);
+                                       rf_FreeASMHeaderListElem(raidPtr, tmpasmhle);
                                }
 
                                asmhle = failed_stripe->asmh_b;
                                while (asmhle) {
                                        tmpasmhle= asmhle;
                                        asmhle = tmpasmhle->next;
-                                       rf_FreeASMHeaderListElem(tmpasmhle);
+                                       rf_FreeASMHeaderListElem(raidPtr, tmpasmhle);
                                }
                                vfple = failed_stripe->vfple;
                                while (vfple) {
                                        tmpvfple = vfple;
                                        vfple = tmpvfple->next;
-                                       rf_FreeVFPListElem(tmpvfple);
+                                       rf_FreeVFPListElem(raidPtr, tmpvfple);
                                }
 
                                vfple = failed_stripe->bvfple;
                                while (vfple) {
                                        tmpvfple = vfple;
                                        vfple = tmpvfple->next;
-                                       rf_FreeVFPListElem(tmpvfple);
+                                       rf_FreeVFPListElem(raidPtr, tmpvfple);
                                }
 
                                tmpfailed_stripe = failed_stripe;
                                failed_stripe = tmpfailed_stripe->next;
-                               rf_FreeFailedStripeStruct(tmpfailed_stripe);
+                               rf_FreeFailedStripeStruct(raidPtr, tmpfailed_stripe);
                        }
                }
                while (stripeFuncsList != NULL) {
                        temp = stripeFuncsList;
                        stripeFuncsList = stripeFuncsList->next;
-                       rf_FreeFuncList(temp);
+                       rf_FreeFuncList(raidPtr, temp);
                }
                return (0);
        }
diff -r 816c3e567eed -r 9f285f822963 sys/dev/raidframe/rf_callback.c
--- a/sys/dev/raidframe/rf_callback.c   Fri Jul 23 00:26:19 2021 +0000
+++ b/sys/dev/raidframe/rf_callback.c   Fri Jul 23 00:54:45 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_callback.c,v 1.24 2019/10/10 03:43:59 christos Exp $        */
+/*     $NetBSD: rf_callback.c,v 1.25 2021/07/23 00:54:45 oster Exp $   */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -34,7 +34,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_callback.c,v 1.24 2019/10/10 03:43:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_callback.c,v 1.25 2021/07/23 00:54:45 oster Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 #include <sys/pool.h>
@@ -46,51 +46,57 @@
 #include "rf_general.h"
 #include "rf_shutdown.h"
 #include "rf_netbsd.h"
+#include "rf_raid.h"
 
 #define RF_MAX_FREE_CALLBACK 64
 #define RF_MIN_FREE_CALLBACK 32
 
 static void rf_ShutdownCallback(void *);
 static void
-rf_ShutdownCallback(void *ignored)
+rf_ShutdownCallback(void *arg)
 {
-       pool_destroy(&rf_pools.callbackf);
-       pool_destroy(&rf_pools.callbackv);
+       RF_Raid_t *raidPtr;
+
+       raidPtr = (RF_Raid_t *) arg;
+       
+       pool_destroy(&raidPtr->pools.callbackf);
+       pool_destroy(&raidPtr->pools.callbackv);
 }
 
 int
-rf_ConfigureCallback(RF_ShutdownList_t **listp)
+rf_ConfigureCallback(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
+                    RF_Config_t *cfgPtr)
 {
 
-       rf_pool_init(&rf_pools.callbackf, sizeof(RF_CallbackFuncDesc_t),
-                    "rf_callbackfpl", RF_MIN_FREE_CALLBACK, RF_MAX_FREE_CALLBACK);
-       rf_pool_init(&rf_pools.callbackv, sizeof(RF_CallbackValueDesc_t),
-                    "rf_callbackvpl", RF_MIN_FREE_CALLBACK, RF_MAX_FREE_CALLBACK);
-       rf_ShutdownCreate(listp, rf_ShutdownCallback, NULL);
+       rf_pool_init(raidPtr, raidPtr->poolNames.callbackf, &raidPtr->pools.callbackf, sizeof(RF_CallbackFuncDesc_t),
+                    "callbackf", RF_MIN_FREE_CALLBACK, RF_MAX_FREE_CALLBACK);
+       rf_pool_init(raidPtr, raidPtr->poolNames.callbackv, &raidPtr->pools.callbackv, sizeof(RF_CallbackValueDesc_t),
+                    "callbackv", RF_MIN_FREE_CALLBACK, RF_MAX_FREE_CALLBACK);



Home | Main Index | Thread Index | Old Index