diff options
| author | explorer <explorer@NetBSD.org> | 1999-01-15 17:55:52 +0000 |
|---|---|---|
| committer | explorer <explorer@NetBSD.org> | 1999-01-15 17:55:52 +0000 |
| commit | edd259d12e04f21d1e8133959e237f0aa24cff91 (patch) | |
| tree | 9fb5333ae2b94a7e745ee87dac23a55836f1dddb /sys/dev/raidframe | |
| parent | 21a687eb013a36a1c9ce0a597325427e9d9cf710 (diff) | |
Make it so raidframe will only perform synchronous writes, and async
reads. This avoids a problem where many writes will cause the driver
to allocate way too much memory.
This needs to change to a queueing system later, which will provide a
way to limit the memory consumed by the driver.
Without these changes, raidframe would use 24M or more on my machine when
the buffer cache dumped all its dirty blocks. Now it uses around 200k
or so.
Diffstat (limited to 'sys/dev/raidframe')
| -rw-r--r-- | sys/dev/raidframe/rf_desc.h | 4 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_driver.c | 5 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_netbsdkintf.c | 20 | ||||
| -rw-r--r-- | sys/dev/raidframe/rf_states.c | 9 |
4 files changed, 31 insertions, 7 deletions
diff --git a/sys/dev/raidframe/rf_desc.h b/sys/dev/raidframe/rf_desc.h index cc0a5283b51..94efc7476ab 100644 --- a/sys/dev/raidframe/rf_desc.h +++ b/sys/dev/raidframe/rf_desc.h @@ -1,4 +1,4 @@ -/* $NetBSD: rf_desc.h,v 1.1 1998/11/13 04:20:28 oster Exp $ */ +/* $NetBSD: rf_desc.h,v 1.2 1999/01/15 17:55:52 explorer Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -171,8 +171,8 @@ struct RF_RaidAccessDesc_s { #ifdef SIMULATE RF_Owner_t owner; - int async_flag; #endif /* SIMULATE */ + int async_flag; RF_Etimer_t timer; /* used for timing this access */ }; diff --git a/sys/dev/raidframe/rf_driver.c b/sys/dev/raidframe/rf_driver.c index 15c3681d48f..5266010ea1a 100644 --- a/sys/dev/raidframe/rf_driver.c +++ b/sys/dev/raidframe/rf_driver.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.c,v 1.2 1998/11/13 13:45:15 drochner Exp $ */ +/* $NetBSD: rf_driver.c,v 1.3 1999/01/15 17:55:52 explorer Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -1419,9 +1419,10 @@ bp_in is a buf pointer. void * to facilitate ignoring it outside the kernel RF_ETIMER_START(desc->tracerec.tot_timer); + desc->async_flag = async_flag; + #ifdef SIMULATE /* simulator uses paramDesc to continue dag from test function */ - desc->async_flag=async_flag; *paramDesc=desc; diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c index 63b7bb70a7b..4354740ad01 100644 --- a/sys/dev/raidframe/rf_netbsdkintf.c +++ b/sys/dev/raidframe/rf_netbsdkintf.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.6 1999/01/14 22:49:05 thorpej Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.7 1999/01/15 17:55:52 explorer Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -1479,6 +1479,7 @@ int rf_DoAccessKernel(raidPtr, bp, flags, cbFunc, cbArg) daddr_t blocknum; int unit; struct raid_softc *rs; + int do_async; /* XXX The dev_t used here should be for /dev/[r]raid* !!! */ @@ -1540,17 +1541,32 @@ int rf_DoAccessKernel(raidPtr, bp, flags, cbFunc, cbArg) } db1_printf(("Calling DoAccess..\n")); + /* + * XXX For now, all writes are sync + */ + do_async = 1; + if ((bp->b_flags & B_READ) == 0) + do_async = 0; + /* don't ever condition on bp->b_flags & B_WRITE. always condition on B_READ instead */ retcode = rf_DoAccess(raidPtr, (bp->b_flags & B_READ) ? RF_IO_TYPE_READ : RF_IO_TYPE_WRITE, - 0, raid_addr, num_blocks, bp->b_un.b_addr, + do_async, raid_addr, num_blocks, + bp->b_un.b_addr, bp, NULL, NULL, RF_DAG_NONBLOCKING_IO|flags, NULL, cbFunc, cbArg); #if 0 db1_printf(("After call to DoAccess: 0x%x 0x%x %d\n",bp, bp->b_data,(int)bp->b_resid)); #endif + + /* + * If we requested sync I/O, sleep here. + */ + if ((retcode == 0) && (do_async == 0)) + tsleep(bp, PRIBIO, "raidsyncio", 0); + return(retcode); } diff --git a/sys/dev/raidframe/rf_states.c b/sys/dev/raidframe/rf_states.c index c9f6b524eba..b310a29bb01 100644 --- a/sys/dev/raidframe/rf_states.c +++ b/sys/dev/raidframe/rf_states.c @@ -1,4 +1,4 @@ -/* $NetBSD: rf_states.c,v 1.2 1998/11/13 13:47:56 drochner Exp $ */ +/* $NetBSD: rf_states.c,v 1.3 1999/01/15 17:55:52 explorer Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -420,6 +420,13 @@ int rf_State_LastState(RF_RaidAccessDesc_t *desc) #else RF_DKU_END_IO(((RF_Raid_t *)desc->raidPtr)->raidid); #endif /* DKUSAGE > 0 */ + + /* + * If this is not an async request, wake up the caller + */ + if (desc->async_flag == 0) + wakeup(desc->bp); + /* printf("Calling biodone on 0x%x\n",desc->bp); */ biodone(desc->bp); /* access came through ioctl */ } |
