summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2003-09-08 13:36:26 +0000
committersos <sos@FreeBSD.org>2003-09-08 13:36:26 +0000
commitfa2b1d63132cc2da0e6c591c6d031d1ae3940410 (patch)
tree12dc06a5af29812212de48d23978bd5b709a8606 /sys
parent0c9be51c08f04345733e1a1bc9d7468cd2f9c962 (diff)
downloadFreeBSD-src-fa2b1d63132cc2da0e6c591c6d031d1ae3940410.zip
FreeBSD-src-fa2b1d63132cc2da0e6c591c6d031d1ae3940410.tar.gz
Limit the size of the rebuild requests to be within safety.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ata/ata-raid.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c
index 8477db0..7293cc1 100644
--- a/sys/dev/ata/ata-raid.c
+++ b/sys/dev/ata/ata-raid.c
@@ -75,6 +75,8 @@ static void ar_print_conf(struct ar_softc *);
static struct ar_softc **ar_table = NULL;
static MALLOC_DEFINE(M_AR, "AR driver", "ATA RAID driver");
+#define AR_REBUILD_SIZE 128
+
int
ata_raiddisk_attach(struct ad_softc *adp)
{
@@ -1008,14 +1010,15 @@ ar_rebuild(void *arg)
/* setup start conditions */
s = splbio();
rdp->lock_start = 0;
- rdp->lock_end = rdp->lock_start + 256;
+ rdp->lock_end = rdp->lock_start + AR_REBUILD_SIZE;
rdp->flags |= AR_F_REBUILDING;
splx(s);
- buffer = malloc(256 * DEV_BSIZE, M_AR, M_NOWAIT | M_ZERO);
+ buffer = malloc(AR_REBUILD_SIZE * DEV_BSIZE, M_AR, M_NOWAIT | M_ZERO);
/* now go copy entire disk(s) */
while (rdp->lock_end < (rdp->total_sectors / rdp->width)) {
- int size = min(256, (rdp->total_sectors / rdp->width) - rdp->lock_end);
+ int size = min(AR_REBUILD_SIZE,
+ (rdp->total_sectors / rdp->width) - rdp->lock_end);
for (disk = 0; disk < rdp->width; disk++) {
struct ad_softc *adp;
OpenPOWER on IntegriCloud