Change the way loadbalancing works on RAID1's.

Based on code partially by me and by <Tor.Egge@cvsup.no.freebsd.org>.
This commit is contained in:
Søren Schmidt 2003-05-04 16:17:54 +00:00
parent 40791d9d15
commit 64ff745cf5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114665
2 changed files with 28 additions and 6 deletions

View file

@ -764,13 +764,34 @@ arstrategy(struct bio *bp)
return;
}
if (bp->bio_cmd == BIO_READ) {
if ((buf1->bp.bio_pblkno <
(rdp->disks[buf1->drive].last_lba - AR_PROXIMITY) ||
buf1->bp.bio_pblkno >
(rdp->disks[buf1->drive].last_lba + AR_PROXIMITY) ||
!(rdp->disks[buf1->drive].flags & AR_DF_ONLINE)) &&
(rdp->disks[buf1->drive+rdp->width].flags & AR_DF_ONLINE))
/* if mirror gone or close to last access on source */
if (!(rdp->disks[buf1->drive+rdp->width].flags & AR_DF_ONLINE)||
(buf1->bp.bio_pblkno >=
(rdp->disks[buf1->drive].last_lba - AR_PROXIMITY) &&
buf1->bp.bio_pblkno <=
(rdp->disks[buf1->drive].last_lba + AR_PROXIMITY))) {
rdp->flags &= ~AR_F_TOGGLE;
}
/* if source gone or close to last access on mirror */
else if (!(rdp->disks[buf1->drive].flags & AR_DF_ONLINE) ||
(buf1->bp.bio_pblkno >=
(rdp->disks[buf1->drive + rdp->width].last_lba -
AR_PROXIMITY) &&
buf1->bp.bio_pblkno <=
(rdp->disks[buf1->drive + rdp->width].last_lba +
AR_PROXIMITY))) {
buf1->drive = buf1->drive + rdp->width;
rdp->flags |= AR_F_TOGGLE;
}
/* not close to any previous access, toggle */
else {
if (rdp->flags & AR_F_TOGGLE)
rdp->flags &= ~AR_F_TOGGLE;
else {
buf1->drive = buf1->drive + rdp->width;
rdp->flags |= AR_F_TOGGLE;
}
}
}
if (bp->bio_cmd == BIO_WRITE) {
if ((rdp->disks[buf1->drive+rdp->width].flags & AR_DF_ONLINE) ||

View file

@ -64,6 +64,7 @@ struct ar_softc {
#define AR_F_PROMISE_RAID 0x1000
#define AR_F_HIGHPOINT_RAID 0x2000
#define AR_F_FREEBSD_RAID 0x4000
#define AR_F_TOGGLE 0x8000
int total_disks; /* number of disks in this array */
int generation; /* generation of this array */