summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe/rf_diskqueue.c
diff options
context:
space:
mode:
authoroster <oster@NetBSD.org>2021-07-23 00:54:45 +0000
committeroster <oster@NetBSD.org>2021-07-23 00:54:45 +0000
commitdfc45731f345ae91b10761e5f43a07615d8d7fae (patch)
tree139abcc17eaf3474460e469c9e08802d4d99429e /sys/dev/raidframe/rf_diskqueue.c
parentd154584da104eff3a163bd87aac810f95a2f4350 (diff)
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 (limited to 'sys/dev/raidframe/rf_diskqueue.c')
-rw-r--r--sys/dev/raidframe/rf_diskqueue.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/sys/dev/raidframe/rf_diskqueue.c b/sys/dev/raidframe/rf_diskqueue.c
index fcd4527446c..e26c262895b 100644
--- a/sys/dev/raidframe/rf_diskqueue.c
+++ b/sys/dev/raidframe/rf_diskqueue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rf_diskqueue.c,v 1.59 2021/07/23 00:26:19 oster Exp $ */
+/* $NetBSD: rf_diskqueue.c,v 1.60 2021/07/23 00:54:45 oster Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
* All rights reserved.
@@ -66,7 +66,7 @@
****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.59 2021/07/23 00:26:19 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.60 2021/07/23 00:54:45 oster Exp $");
#include <dev/raidframe/raidframevar.h>
@@ -193,21 +193,27 @@ rf_ConfigureDiskQueue(RF_Raid_t *raidPtr, RF_DiskQueue_t *diskqueue,
}
static void
-rf_ShutdownDiskQueueSystem(void *ignored)
+rf_ShutdownDiskQueueSystem(void *arg)
{
- pool_destroy(&rf_pools.dqd);
- pool_destroy(&rf_pools.bufio);
+ RF_Raid_t *raidPtr;
+
+ raidPtr = (RF_Raid_t *) arg;
+
+ pool_destroy(&raidPtr->pools.dqd);
+ pool_destroy(&raidPtr->pools.bufio);
}
int
-rf_ConfigureDiskQueueSystem(RF_ShutdownList_t **listp)
+rf_ConfigureDiskQueueSystem(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
+ RF_Config_t *cfgPtr)
+
{
- rf_pool_init(&rf_pools.dqd, sizeof(RF_DiskQueueData_t),
- "rf_dqd_pl", RF_MIN_FREE_DQD, RF_MAX_FREE_DQD);
- rf_pool_init(&rf_pools.bufio, sizeof(buf_t),
- "rf_bufio_pl", RF_MIN_FREE_BUFIO, RF_MAX_FREE_BUFIO);
- rf_ShutdownCreate(listp, rf_ShutdownDiskQueueSystem, NULL);
+ rf_pool_init(raidPtr, raidPtr->poolNames.dqd, &raidPtr->pools.dqd, sizeof(RF_DiskQueueData_t),
+ "dqd", RF_MIN_FREE_DQD, RF_MAX_FREE_DQD);
+ rf_pool_init(raidPtr, raidPtr->poolNames.bufio, &raidPtr->pools.bufio, sizeof(buf_t),
+ "bufio", RF_MIN_FREE_BUFIO, RF_MAX_FREE_BUFIO);
+ rf_ShutdownCreate(listp, rf_ShutdownDiskQueueSystem, raidPtr);
return (0);
}
@@ -377,7 +383,7 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect,
{
RF_DiskQueueData_t *p;
- p = pool_get(&rf_pools.dqd, PR_WAITOK | PR_ZERO);
+ p = pool_get(&raidPtr->pools.dqd, PR_WAITOK | PR_ZERO);
KASSERT(p != NULL);
/* Obtain a buffer from our own pool. It is possible for the
@@ -386,7 +392,7 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect,
doesn't have a good way to recover if memory allocation
fails here.
*/
- p->bp = pool_get(&rf_pools.bufio, PR_WAITOK | PR_ZERO);
+ p->bp = pool_get(&raidPtr->pools.bufio, PR_WAITOK | PR_ZERO);
KASSERT(p->bp != NULL);
buf_init(p->bp);
@@ -416,6 +422,6 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect,
void
rf_FreeDiskQueueData(RF_DiskQueueData_t *p)
{
- pool_put(&rf_pools.bufio, p->bp);
- pool_put(&rf_pools.dqd, p);
+ pool_put(&p->raidPtr->pools.bufio, p->bp);
+ pool_put(&p->raidPtr->pools.dqd, p);
}